home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / manual / texinfo.tex < prev    next >
Encoding:
Text File  |  1994-11-07  |  140.1 KB  |  4,357 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 1994 Free Software Foundation, Inc.
  4.  
  5. %This texinfo.tex file is free software; you can redistribute it and/or
  6. %modify it under the terms of the GNU General Public License as
  7. %published by the Free Software Foundation; either version 2, or (at
  8. %your option) any later version.
  9.  
  10. %This texinfo.tex file is distributed in the hope that it will be
  11. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  12. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. %General Public License for more details.
  14.  
  15. %You should have received a copy of the GNU General Public License
  16. %along with this texinfo.tex file; see the file COPYING.  If not, write
  17. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  18. %USA.
  19.  
  20.  
  21. %In other words, you are welcome to use, share and improve this program.
  22. %You are forbidden to forbid anyone else to use, share and improve
  23. %what you give them.   Help stamp out software-hoarding!
  24.  
  25. % This automatically updates the version number based on RCS.
  26. \def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
  27. \deftexinfoversion$Revision: 2.136 $
  28. \message{Loading texinfo package [Version \texinfoversion]:}
  29.  
  30. % Print the version number if in a .fmt file.
  31. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  32.  
  33. % Save some parts of plain tex whose names we will redefine.
  34.  
  35. \let\ptextilde=\~
  36. \let\ptexlbrace=\{
  37. \let\ptexrbrace=\}
  38. \let\ptexdots=\dots
  39. \let\ptexdot=\.
  40. \let\ptexstar=\*
  41. \let\ptexend=\end
  42. \let\ptexbullet=\bullet
  43. \let\ptexb=\b
  44. \let\ptexc=\c
  45. \let\ptexi=\i
  46. \let\ptext=\t
  47. \let\ptexl=\l
  48. \let\ptexL=\L
  49.  
  50. % Be sure we're in horizontal mode when doing a tie, since we make space
  51. % equivalent to this in @example-like environments. Otherwise, a space
  52. % at the beginning of a line will start with \penalty -- and
  53. % since \penalty is valid in vertical mode, we'd end up putting the
  54. % penalty on the vertical list instead of in the new paragraph.
  55. {\catcode`@ = 11
  56.  \gdef\tie{\leavevmode\penalty\@M\ }
  57. }
  58. \let\~ = \tie                  % And make it available as @~.
  59.  
  60. \message{Basics,}
  61. \chardef\other=12
  62.  
  63. % If this character appears in an error message or help string, it
  64. % starts a new line in the output.
  65. \newlinechar = `^^J
  66.  
  67. % Set up fixed words for English.
  68. \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
  69. \def\putwordInfo{Info}%
  70. \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
  71. \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
  72. \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
  73. \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
  74. \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
  75. \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
  76. \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
  77. \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
  78. \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
  79.  
  80. % Ignore a token.
  81. %
  82. \def\gobble#1{}
  83.  
  84. \hyphenation{ap-pen-dix}
  85. \hyphenation{mini-buf-fer mini-buf-fers}
  86. \hyphenation{eshell}
  87.  
  88. % Margin to add to right of even pages, to left of odd pages.
  89. \newdimen \bindingoffset  \bindingoffset=0pt
  90. \newdimen \normaloffset   \normaloffset=\hoffset
  91. \newdimen\pagewidth \newdimen\pageheight
  92. \pagewidth=\hsize \pageheight=\vsize
  93.  
  94. % Sometimes it is convenient to have everything in the transcript file
  95. % and nothing on the terminal.  We don't just call \tracingall here,
  96. % since that produces some useless output on the terminal.
  97. %
  98. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  99. \def\loggingall{\tracingcommands2 \tracingstats2
  100.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  101.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  102.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  103. }%
  104.  
  105. %---------------------Begin change-----------------------
  106. %
  107. %%%% For @cropmarks command.
  108. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  109. %
  110. \newdimen\cornerlong \newdimen\cornerthick
  111. \newdimen \topandbottommargin
  112. \newdimen \outerhsize \newdimen \outervsize
  113. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  114. \outerhsize=7in
  115. %\outervsize=9.5in
  116. % Alternative @smallbook page size is 9.25in
  117. \outervsize=9.25in
  118. \topandbottommargin=.75in
  119. %
  120. %---------------------End change-----------------------
  121.  
  122. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  123. % does insertions itself, but you have to call it yourself.
  124. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  125. \def\onepageout#1{\hoffset=\normaloffset
  126. \ifodd\pageno  \advance\hoffset by \bindingoffset
  127. \else \advance\hoffset by -\bindingoffset\fi
  128. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  129. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  130. {\let\hsize=\pagewidth \makefootline}}}%
  131. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  132.  
  133. %%%% For @cropmarks command %%%%
  134.  
  135. % Here is a modification of the main output routine for Near East Publications
  136. % This provides right-angle cropmarks at all four corners.
  137. % The contents of the page are centerlined into the cropmarks,
  138. % and any desired binding offset is added as an \hskip on either
  139. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  140. %
  141. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  142. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  143.          \shipout
  144.          \vbox to \outervsize{\hsize=\outerhsize
  145.                  \vbox{\line{\ewtop\hfill\ewtop}}
  146.                  \nointerlineskip
  147.                  \line{\vbox{\moveleft\cornerthick\nstop}
  148.                        \hfill
  149.                        \vbox{\moveright\cornerthick\nstop}}
  150.                  \vskip \topandbottommargin
  151.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  152.             \vbox{
  153.             {\let\hsize=\pagewidth \makeheadline}
  154.             \pagebody{#1}
  155.             {\let\hsize=\pagewidth \makefootline}}
  156.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  157.          \vskip \topandbottommargin plus1fill minus1fill
  158.                  \boxmaxdepth\cornerthick
  159.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  160.                        \hfill
  161.                        \vbox{\moveright\cornerthick\nsbot}}
  162.                  \nointerlineskip
  163.                  \vbox{\line{\ewbot\hfill\ewbot}}
  164.     }}
  165.   \advancepageno
  166.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  167. %
  168. % Do @cropmarks to get crop marks
  169. \def\cropmarks{\let\onepageout=\croppageout }
  170.  
  171. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  172. {\catcode`\@ =11
  173. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  174. \dimen@=\dp#1 \unvbox#1
  175. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  176. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  177. }
  178.  
  179. %
  180. % Here are the rules for the cropmarks.  Note that they are
  181. % offset so that the space between them is truly \outerhsize or \outervsize
  182. % (P. A. MacKay, 12 November, 1986)
  183. %
  184. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  185. \def\nstop{\vbox
  186.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  187. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  188. \def\nsbot{\vbox
  189.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  190.  
  191. % Parse an argument, then pass it to #1.  The argument is the rest of
  192. % the input line (except we remove a trailing comment).  #1 should be a
  193. % macro which expects an ordinary undelimited TeX argument.
  194. %
  195. \def\parsearg#1{%
  196.   \let\next = #1%
  197.   \begingroup
  198.     \obeylines
  199.     \futurelet\temp\parseargx
  200. }
  201.  
  202. % If the next token is an obeyed space (from an @example environment or
  203. % the like), remove it and recurse.  Otherwise, we're done.
  204. \def\parseargx{%
  205.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  206.   \ifx\obeyedspace\temp
  207.     \expandafter\parseargdiscardspace
  208.   \else
  209.     \expandafter\parseargline
  210.   \fi
  211. }
  212.  
  213. % Remove a single space (as the delimiter token to the macro call).
  214. {\obeyspaces %
  215.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  216.  
  217. {\obeylines %
  218.   \gdef\parseargline#1^^M{%
  219.     \endgroup % End of the group started in \parsearg.
  220.     %
  221.     % First remove any @c comment, then any @comment.
  222.     % Result of each macro is put in \toks0.
  223.     \argremovec #1\c\relax %
  224.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  225.     %
  226.     % Call the caller's macro, saved as \next in \parsearg.
  227.     \expandafter\next\expandafter{\the\toks0}%
  228.   }%
  229. }
  230.  
  231. % Since all \c{,omment} does is throw away the argument, we can let TeX
  232. % do that for us.  The \relax here is matched by the \relax in the call
  233. % in \parseargline; it could be more or less anything, its purpose is
  234. % just to delimit the argument to the \c.
  235. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  236. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  237.  
  238. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  239. %    @end itemize  @c foo
  240. % will have two active spaces as part of the argument with the
  241. % `itemize'.  Here we remove all active spaces from #1, and assign the
  242. % result to \toks0.
  243. %
  244. % This loses if there are any *other* active characters besides spaces
  245. % in the argument -- _ ^ +, for example -- since they get expanded.
  246. % Fortunately, Texinfo does not define any such commands.  (If it ever
  247. % does, the catcode of the characters in questionwill have to be changed
  248. % here.)  But this means we cannot call \removeactivespaces as part of
  249. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  250. % that \parsearg gets might well have any character at all in it.
  251. %
  252. \def\removeactivespaces#1{%
  253.   \begingroup
  254.     \ignoreactivespaces
  255.     \edef\temp{#1}%
  256.     \global\toks0 = \expandafter{\temp}%
  257.   \endgroup
  258. }
  259.  
  260. % Change the active space to expand to nothing.
  261. %
  262. \begingroup
  263.   \obeyspaces
  264.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  265. \endgroup
  266.  
  267.  
  268. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  269.  
  270. %% These are used to keep @begin/@end levels from running away
  271. %% Call \inENV within environments (after a \begingroup)
  272. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  273. \def\ENVcheck{%
  274. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  275. \endgroup\fi} % This is not perfect, but it should reduce lossage
  276.  
  277. % @begin foo  is the same as @foo, for now.
  278. \newhelp\EMsimple{Type <Return> to continue.}
  279.  
  280. \outer\def\begin{\parsearg\beginxxx}
  281.  
  282. \def\beginxxx #1{%
  283. \expandafter\ifx\csname #1\endcsname\relax
  284. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  285. \csname #1\endcsname\fi}
  286.  
  287. % @end foo executes the definition of \Efoo.
  288. %
  289. \def\end{\parsearg\endxxx}
  290. \def\endxxx #1{%
  291.   \removeactivespaces{#1}%
  292.   \edef\endthing{\the\toks0}%
  293.   %
  294.   \expandafter\ifx\csname E\endthing\endcsname\relax
  295.     \expandafter\ifx\csname \endthing\endcsname\relax
  296.       % There's no \foo, i.e., no ``environment'' foo.
  297.       \errhelp = \EMsimple
  298.       \errmessage{Undefined command `@end \endthing'}%
  299.     \else
  300.       \unmatchedenderror\endthing
  301.     \fi
  302.   \else
  303.     % Everything's ok; the right environment has been started.
  304.     \csname E\endthing\endcsname
  305.   \fi
  306. }
  307.  
  308. % There is an environment #1, but it hasn't been started.  Give an error.
  309. %
  310. \def\unmatchedenderror#1{%
  311.   \errhelp = \EMsimple
  312.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  313. }
  314.  
  315. % Define the control sequence \E#1 to give an unmatched @end error.
  316. %
  317. \def\defineunmatchedend#1{%
  318.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  319. }
  320.  
  321.  
  322. % Single-spacing is done by various environments (specifically, in
  323. % \nonfillstart and \quotations).
  324. \newskip\singlespaceskip \singlespaceskip = 12.5pt
  325. \def\singlespace{%
  326.   % Why was this kern here?  It messes up equalizing space above and below
  327.   % environments.  --karl, 6may93
  328.   %{\advance \baselineskip by -\singlespaceskip
  329.   %\kern \baselineskip}%
  330.   \setleading \singlespaceskip
  331. }
  332.  
  333. %% Simple single-character @ commands
  334.  
  335. % @@ prints an @
  336. % Kludge this until the fonts are right (grr).
  337. \def\@{{\tt \char '100}}
  338.  
  339. % This is turned off because it was never documented
  340. % and you can use @w{...} around a quote to suppress ligatures.
  341. %% Define @` and @' to be the same as ` and '
  342. %% but suppressing ligatures.
  343. %\def\`{{`}}
  344. %\def\'{{'}}
  345.  
  346. % Used to generate quoted braces.
  347.  
  348. \def\mylbrace {{\tt \char '173}}
  349. \def\myrbrace {{\tt \char '175}}
  350. \let\{=\mylbrace
  351. \let\}=\myrbrace
  352.  
  353. % @: forces normal size whitespace following.
  354. \def\:{\spacefactor=1000 }
  355.  
  356. % @* forces a line break.
  357. \def\*{\hfil\break\hbox{}\ignorespaces}
  358.  
  359. % @. is an end-of-sentence period.
  360. \def\.{.\spacefactor=3000 }
  361.  
  362. % @enddots{} is an end-of-sentence ellipsis.
  363. \gdef\enddots{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$\spacefactor=3000}
  364.  
  365. % @! is an end-of-sentence bang.
  366. \gdef\!{!\spacefactor=3000 }
  367.  
  368. % @? is an end-of-sentence query.
  369. \gdef\?{?\spacefactor=3000 }
  370.  
  371. % @w prevents a word break.  Without the \leavevmode, @w at the
  372. % beginning of a paragraph, when TeX is still in vertical mode, would
  373. % produce a whole line of output instead of starting the paragraph.
  374. \def\w#1{\leavevmode\hbox{#1}}
  375.  
  376. % @group ... @end group forces ... to be all on one page, by enclosing
  377. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  378. % to keep its height that of a normal line.  According to the rules for
  379. % \topskip (p.114 of the TeXbook), the glue inserted is
  380. % max (\topskip - \ht (first item), 0).  If that height is large,
  381. % therefore, no glue is inserted, and the space between the headline and
  382. % the text is small, which looks bad.
  383. %
  384. \def\group{\begingroup
  385.   \ifnum\catcode13=\active \else
  386.     \errhelp = \groupinvalidhelp
  387.     \errmessage{@group invalid in context where filling is enabled}%
  388.   \fi
  389.   %
  390.   % The \vtop we start below produces a box with normal height and large
  391.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  392.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  393.   % the TeXbook.)  Thus, space below is not quite equal to space
  394.   % above.  But it's pretty close.
  395.   \def\Egroup{%
  396.     \egroup           % End the \vtop.
  397.     \endgroup         % End the \group.
  398.   }%
  399.   %
  400.   \vtop\bgroup
  401.     % We have to put a strut on the last line in case the @group is in
  402.     % the midst of an example, rather than completely enclosing it.
  403.     % Otherwise, the interline space between the last line of the group
  404.     % and the first line afterwards is too small.  But we can't put the
  405.     % strut in \Egroup, since there it would be on a line by itself.
  406.     % Hence this just inserts a strut at the beginning of each line.
  407.     \everypar = {\strut}%
  408.     %
  409.     % Since we have a strut on every line, we don't need any of TeX's
  410.     % normal interline spacing.
  411.     \offinterlineskip
  412.     %
  413.     % OK, but now we have to do something about blank
  414.     % lines in the input in @example-like environments, which normally
  415.     % just turn into \lisppar, which will insert no space now that we've
  416.     % turned off the interline space.  Simplest is to make them be an
  417.     % empty paragraph.
  418.     \ifx\par\lisppar
  419.       \edef\par{\leavevmode \par}%
  420.       %
  421.       % Reset ^^M's definition to new definition of \par.
  422.       \obeylines
  423.     \fi
  424.     %
  425.     % Do @comment since we are called inside an environment such as
  426.     % @example, where each end-of-line in the input causes an
  427.     % end-of-line in the output.  We don't want the end-of-line after
  428.     % the `@group' to put extra space in the output.  Since @group
  429.     % should appear on a line by itself (according to the Texinfo
  430.     % manual), we don't worry about eating any user text.
  431.     \comment
  432. }
  433. %
  434. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  435. % message, so this ends up printing `@group can only ...'.
  436. %
  437. \newhelp\groupinvalidhelp{%
  438. group can only be used in environments such as @example,^^J%
  439. where each line of input produces a line of output.}
  440.  
  441. % @need space-in-mils
  442. % forces a page break if there is not space-in-mils remaining.
  443.  
  444. \newdimen\mil  \mil=0.001in
  445.  
  446. \def\need{\parsearg\needx}
  447.  
  448. % Old definition--didn't work.
  449. %\def\needx #1{\par %
  450. %% This method tries to make TeX break the page naturally
  451. %% if the depth of the box does not fit.
  452. %{\baselineskip=0pt%
  453. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  454. %\prevdepth=-1000pt
  455. %}}
  456.  
  457. \def\needx#1{%
  458.   % Go into vertical mode, so we don't make a big box in the middle of a
  459.   % paragraph.
  460.   \par
  461.   %
  462.   % Don't add any leading before our big empty box, but allow a page
  463.   % break, since the best break might be right here.
  464.   \allowbreak
  465.   \nointerlineskip
  466.   \vtop to #1\mil{\vfil}%
  467.   %
  468.   % TeX does not even consider page breaks if a penalty added to the
  469.   % main vertical list is 10000 or more.  But in order to see if the
  470.   % empty box we just added fits on the page, we must make it consider
  471.   % page breaks.  On the other hand, we don't want to actually break the
  472.   % page after the empty box.  So we use a penalty of 9999.
  473.   %
  474.   % There is an extremely small chance that TeX will actually break the
  475.   % page at this \penalty, if there are no other feasible breakpoints in
  476.   % sight.  (If the user is using lots of big @group commands, which
  477.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  478.   % good page breaking, for example.)  However, I could not construct an
  479.   % example where a page broke at this \penalty; if it happens in a real
  480.   % document, then we can reconsider our strategy.
  481.   \penalty9999
  482.   %
  483.   % Back up by the size of the box, whether we did a page break or not.
  484.   \kern -#1\mil
  485.   %
  486.   % Do not allow a page break right after this kern.
  487.   \nobreak
  488. }
  489.  
  490. % @br   forces paragraph break
  491.  
  492. \let\br = \par
  493.  
  494. % @dots{}  output some dots
  495.  
  496. \def\dots{$\ldots$}
  497.  
  498. % @page    forces the start of a new page
  499.  
  500. \def\page{\par\vfill\supereject}
  501.  
  502. % @exdent text....
  503. % outputs text on separate line in roman font, starting at standard page margin
  504.  
  505. % This records the amount of indent in the innermost environment.
  506. % That's how much \exdent should take out.
  507. \newskip\exdentamount
  508.  
  509. % This defn is used inside fill environments such as @defun.
  510. \def\exdent{\parsearg\exdentyyy}
  511. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  512.  
  513. % This defn is used inside nofill environments such as @example.
  514. \def\nofillexdent{\parsearg\nofillexdentyyy}
  515. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  516. \leftline{\hskip\leftskip{\rm#1}}}}
  517.  
  518. %\hbox{{\rm#1}}\hfil\break}}
  519.  
  520. % @include file    insert text of that file as input.
  521.  
  522. \def\include{\parsearg\includezzz}
  523. %Use \input\thisfile to avoid blank after \input, which may be an active
  524. %char (in which case the blank would become the \input argument).
  525. %The grouping keeps the value of \thisfile correct even when @include
  526. %is nested.
  527. \def\includezzz #1{\begingroup
  528. \def\thisfile{#1}\input\thisfile
  529. \endgroup}
  530.  
  531. \def\thisfile{}
  532.  
  533. % @center line   outputs that line, centered
  534.  
  535. \def\center{\parsearg\centerzzz}
  536. \def\centerzzz #1{{\advance\hsize by -\leftskip
  537. \advance\hsize by -\rightskip
  538. \centerline{#1}}}
  539.  
  540. % @sp n   outputs n lines of vertical space
  541.  
  542. \def\sp{\parsearg\spxxx}
  543. \def\spxxx #1{\par \vskip #1\baselineskip}
  544.  
  545. % @comment ...line which is ignored...
  546. % @c is the same as @comment
  547. % @ignore ... @end ignore  is another way to write a comment
  548.  
  549. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  550. \parsearg \commentxxx}
  551.  
  552. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  553.  
  554. \let\c=\comment
  555.  
  556. % Prevent errors for section commands.
  557. % Used in @ignore and in failing conditionals.
  558. \def\ignoresections{%
  559. \let\chapter=\relax
  560. \let\unnumbered=\relax
  561. \let\top=\relax
  562. \let\unnumberedsec=\relax
  563. \let\unnumberedsection=\relax
  564. \let\unnumberedsubsec=\relax
  565. \let\unnumberedsubsection=\relax
  566. \let\unnumberedsubsubsec=\relax
  567. \let\unnumberedsubsubsection=\relax
  568. \let\section=\relax
  569. \let\subsec=\relax
  570. \let\subsubsec=\relax
  571. \let\subsection=\relax
  572. \let\subsubsection=\relax
  573. \let\appendix=\relax
  574. \let\appendixsec=\relax
  575. \let\appendixsection=\relax
  576. \let\appendixsubsec=\relax
  577. \let\appendixsubsection=\relax
  578. \let\appendixsubsubsec=\relax
  579. \let\appendixsubsubsection=\relax
  580. \let\contents=\relax
  581. \let\smallbook=\relax
  582. \let\titlepage=\relax
  583. }
  584.  
  585. % Used in nested conditionals, where we have to parse the Texinfo source
  586. % and so want to turn off most commands, in case they are used
  587. % incorrectly.
  588. %
  589. \def\ignoremorecommands{%
  590.   \let\defcv = \relax
  591.   \let\deffn = \relax
  592.   \let\deffnx = \relax
  593.   \let\defindex = \relax
  594.   \let\defivar = \relax
  595.   \let\defmac = \relax
  596.   \let\defmethod = \relax
  597.   \let\defop = \relax
  598.   \let\defopt = \relax
  599.   \let\defspec = \relax
  600.   \let\deftp = \relax
  601.   \let\deftypefn = \relax
  602.   \let\deftypefun = \relax
  603.   \let\deftypevar = \relax
  604.   \let\deftypevr = \relax
  605.   \let\defun = \relax
  606.   \let\defvar = \relax
  607.   \let\defvr = \relax
  608.   \let\ref = \relax
  609.   \let\xref = \relax
  610.   \let\printindex = \relax
  611.   \let\pxref = \relax
  612.   \let\settitle = \relax
  613.   \let\include = \relax
  614.   \let\lowersections = \relax
  615.   \let\down = \relax
  616.   \let\raisesections = \relax
  617.   \let\up = \relax
  618.   \let\set = \relax
  619.   \let\clear = \relax
  620.   \let\item = \relax
  621.   \let\message = \relax
  622. }
  623.  
  624. % Ignore @ignore ... @end ignore.
  625. %
  626. \def\ignore{\doignore{ignore}}
  627.  
  628. % Also ignore @ifinfo, @ifhtml, @html, @menu, and @direntry text.
  629. %
  630. \def\ifinfo{\doignore{ifinfo}}
  631. \def\ifhtml{\doignore{ifhtml}}
  632. \def\html{\doignore{html}}
  633. \def\menu{\doignore{menu}}
  634. \def\direntry{\doignore{direntry}}
  635.  
  636. % Ignore text until a line `@end #1'.
  637. %
  638. \def\doignore#1{\begingroup
  639.   % Don't complain about control sequences we have declared \outer.
  640.   \ignoresections
  641.   %
  642.   % Define a command to swallow text until we reach `@end #1'.
  643.   \long\def\doignoretext##1\end #1{\enddoignore}%
  644.   %
  645.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  646.   \catcode32 = 10
  647.   %
  648.   % And now expand that command.
  649.   \doignoretext
  650. }
  651.  
  652. % What we do to finish off ignored text.
  653. %
  654. \def\enddoignore{\endgroup\ignorespaces}%
  655.  
  656. \newif\ifwarnedobs\warnedobsfalse
  657. \def\obstexwarn{%
  658.   \ifwarnedobs\relax\else
  659.   % We need to warn folks that they may have trouble with TeX 3.0.
  660.   % This uses \immediate\write16 rather than \message to get newlines.
  661.     \immediate\write16{}
  662.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  663.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  664.     \immediate\write16{If you are running another version of TeX, relax.}
  665.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  666.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  667.     \immediate\write16{If you are stuck with version 3.0, run the}
  668.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  669.     \immediate\write16{  to use a workaround.}
  670.     \immediate\write16{}
  671.     \warnedobstrue
  672.     \fi
  673. }
  674.  
  675. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  676. % workaround (which requires the file ``dummy.tfm'' to be installed),
  677. % uncomment the following line:
  678. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  679.  
  680. % Ignore text, except that we keep track of conditional commands for
  681. % purposes of nesting, up to an `@end #1' command.
  682. %
  683. \def\nestedignore#1{%
  684.   \obstexwarn
  685.   % We must actually expand the ignored text to look for the @end
  686.   % command, so that nested ignore constructs work.  Thus, we put the
  687.   % text into a \vbox and then do nothing with the result.  To minimize
  688.   % the change of memory overflow, we follow the approach outlined on
  689.   % page 401 of the TeXbook: make the current font be a dummy font.
  690.   %
  691.   \setbox0 = \vbox\bgroup
  692.     % Don't complain about control sequences we have declared \outer.
  693.     \ignoresections
  694.     %
  695.     % Define `@end #1' to end the box, which will in turn undefine the
  696.     % @end command again.
  697.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  698.     %
  699.     % We are going to be parsing Texinfo commands.  Most cause no
  700.     % trouble when they are used incorrectly, but some commands do
  701.     % complicated argument parsing or otherwise get confused, so we
  702.     % undefine them.
  703.     %
  704.     % We can't do anything about stray @-signs, unfortunately;
  705.     % they'll produce `undefined control sequence' errors.
  706.     \ignoremorecommands
  707.     %
  708.     % Set the current font to be \nullfont, a TeX primitive, and define
  709.     % all the font commands to also use \nullfont.  We don't use
  710.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  711.     % might have that installed.  Therefore, math mode will still
  712.     % produce output, but that should be an extremely small amount of
  713.     % stuff compared to the main input.
  714.     %
  715.     \nullfont
  716.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  717.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  718.     \let\tensf = \nullfont
  719.     % Similarly for index fonts (mostly for their use in
  720.     % smallexample)
  721.     \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
  722.     \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
  723.     \let\indsf = \nullfont
  724.     %
  725.     % Don't complain when characters are missing from the fonts.
  726.     \tracinglostchars = 0
  727.     %
  728.     % Don't bother to do space factor calculations.
  729.     \frenchspacing
  730.     %
  731.     % Don't report underfull hboxes.
  732.     \hbadness = 10000
  733.     %
  734.     % Do minimal line-breaking.
  735.     \pretolerance = 10000
  736.     %
  737.     % Do not execute instructions in @tex
  738.     \def\tex{\doignore{tex}}
  739. }
  740.  
  741. % @set VAR sets the variable VAR to an empty value.
  742. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  743. %
  744. % Since we want to separate VAR from REST-OF-LINE (which might be
  745. % empty), we can't just use \parsearg; we have to insert a space of our
  746. % own to delimit the rest of the line, and then take it out again if we
  747. % didn't need it.
  748. %
  749. \def\set{\parsearg\setxxx}
  750. \def\setxxx#1{\setyyy#1 \endsetyyy}
  751. \def\setyyy#1 #2\endsetyyy{%
  752.   \def\temp{#2}%
  753.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  754.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  755.   \fi
  756. }
  757. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  758.  
  759. % @clear VAR clears (i.e., unsets) the variable VAR.
  760. %
  761. \def\clear{\parsearg\clearxxx}
  762. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  763.  
  764. % @value{foo} gets the text saved in variable foo.
  765. %
  766. \def\value#1{\expandafter
  767.         \ifx\csname SET#1\endcsname\relax
  768.             {\{No value for ``#1''\}}
  769.         \else \csname SET#1\endcsname \fi}
  770.  
  771. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  772. % with @set.
  773. %
  774. \def\ifset{\parsearg\ifsetxxx}
  775. \def\ifsetxxx #1{%
  776.   \expandafter\ifx\csname SET#1\endcsname\relax
  777.     \expandafter\ifsetfail
  778.   \else
  779.     \expandafter\ifsetsucceed
  780.   \fi
  781. }
  782. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  783. \def\ifsetfail{\nestedignore{ifset}}
  784. \defineunmatchedend{ifset}
  785.  
  786. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  787. % defined with @set, or has been undefined with @clear.
  788. %
  789. \def\ifclear{\parsearg\ifclearxxx}
  790. \def\ifclearxxx #1{%
  791.   \expandafter\ifx\csname SET#1\endcsname\relax
  792.     \expandafter\ifclearsucceed
  793.   \else
  794.     \expandafter\ifclearfail
  795.   \fi
  796. }
  797. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  798. \def\ifclearfail{\nestedignore{ifclear}}
  799. \defineunmatchedend{ifclear}
  800.  
  801. % @iftex always succeeds; we read the text following, through @end
  802. % iftex).  But `@end iftex' should be valid only after an @iftex.
  803. %
  804. \def\iftex{\conditionalsucceed{iftex}}
  805. \defineunmatchedend{iftex}
  806.  
  807. % We can't just want to start a group at @iftex (for example) and end it
  808. % at @end iftex, since then @set commands inside the conditional have no
  809. % effect (they'd get reverted at the end of the group).  So we must
  810. % define \Eiftex to redefine itself to be its previous value.  (We can't
  811. % just define it to fail again with an ``unmatched end'' error, since
  812. % the @ifset might be nested.)
  813. %
  814. \def\conditionalsucceed#1{%
  815.   \edef\temp{%
  816.     % Remember the current value of \E#1.
  817.     \let\nece{prevE#1} = \nece{E#1}%
  818.     %
  819.     % At the `@end #1', redefine \E#1 to be its previous value.
  820.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  821.   }%
  822.   \temp
  823. }
  824.  
  825. % We need to expand lots of \csname's, but we don't want to expand the
  826. % control sequences after we've constructed them.
  827. %
  828. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  829.  
  830. % @asis just yields its argument.  Used with @table, for example.
  831. %
  832. \def\asis#1{#1}
  833.  
  834. % @math means output in math mode.
  835. % We don't use $'s directly in the definition of \math because control
  836. % sequences like \math are expanded when the toc file is written.  Then,
  837. % we read the toc file back, the $'s will be normal characters (as they
  838. % should be, according to the definition of Texinfo).  So we must use a
  839. % control sequence to switch into and out of math mode.
  840. %
  841. % This isn't quite enough for @math to work properly in indices, but it
  842. % seems unlikely it will ever be needed there.
  843. %
  844. \let\implicitmath = $
  845. \def\math#1{\implicitmath #1\implicitmath}
  846.  
  847. % @bullet and @minus need the same treatment as @math, just above.
  848. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  849. \def\minus{\implicitmath-\implicitmath}
  850.  
  851. \def\node{\ENVcheck\parsearg\nodezzz}
  852. \def\nodezzz#1{\nodexxx [#1,]}
  853. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  854. \let\nwnode=\node
  855. \let\lastnode=\relax
  856.  
  857. \def\donoderef{\ifx\lastnode\relax\else
  858. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  859. \global\let\lastnode=\relax}
  860.  
  861. \def\unnumbnoderef{\ifx\lastnode\relax\else
  862. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  863. \global\let\lastnode=\relax}
  864.  
  865. \def\appendixnoderef{\ifx\lastnode\relax\else
  866. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  867. \global\let\lastnode=\relax}
  868.  
  869. \let\refill=\relax
  870.  
  871. % @setfilename is done at the beginning of every texinfo file.
  872. % So open here the files we need to have open while reading the input.
  873. % This makes it possible to make a .fmt file for texinfo.
  874. \def\setfilename{%
  875.    \readauxfile
  876.    \opencontents
  877.    \openindices
  878.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  879.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  880.    \comment % Ignore the actual filename.
  881. }
  882.  
  883. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  884.  
  885. \def\inforef #1{\inforefzzz #1,,,,**}
  886. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  887.   node \samp{\ignorespaces#1{}}}
  888.  
  889. \message{fonts,}
  890.  
  891. % Font-change commands.
  892.  
  893. % Texinfo supports the sans serif font style, which plain TeX does not.
  894. % So we set up a \sf analogous to plain's \rm, etc.
  895. \newfam\sffam
  896. \def\sf{\fam=\sffam \tensf}
  897. \let\li = \sf % Sometimes we call it \li, not \sf.
  898.  
  899. %% Try out Computer Modern fonts at \magstephalf
  900. \let\mainmagstep=\magstephalf
  901.  
  902. \ifx\bigger\relax
  903. \let\mainmagstep=\magstep1
  904. \font\textrm=cmr12
  905. \font\texttt=cmtt12
  906. \else
  907. \font\textrm=cmr10 scaled \mainmagstep
  908. \font\texttt=cmtt10 scaled \mainmagstep
  909. \fi
  910. % Instead of cmb10, you many want to use cmbx10.
  911. % cmbx10 is a prettier font on its own, but cmb10
  912. % looks better when embedded in a line with cmr10.
  913. \font\textbf=cmb10 scaled \mainmagstep
  914. \font\textit=cmti10 scaled \mainmagstep
  915. \font\textsl=cmsl10 scaled \mainmagstep
  916. \font\textsf=cmss10 scaled \mainmagstep
  917. \font\textsc=cmcsc10 scaled \mainmagstep
  918. \font\texti=cmmi10 scaled \mainmagstep
  919. \font\textsy=cmsy10 scaled \mainmagstep
  920.  
  921. % A few fonts for @defun, etc.
  922. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  923. \font\deftt=cmtt10 scaled \magstep1
  924. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  925.  
  926. % Fonts for indices and small examples.
  927. % We actually use the slanted font rather than the italic,
  928. % because texinfo normally uses the slanted fonts for that.
  929. % Do not make many font distinctions in general in the index, since they
  930. % aren't very useful.
  931. \font\ninett=cmtt9
  932. \font\indrm=cmr9
  933. \font\indit=cmsl9
  934. \let\indsl=\indit
  935. \let\indtt=\ninett
  936. \let\indsf=\indrm
  937. \let\indbf=\indrm
  938. \let\indsc=\indrm
  939. \font\indi=cmmi9
  940. \font\indsy=cmsy9
  941.  
  942. % Fonts for headings
  943. \font\chaprm=cmbx12 scaled \magstep2
  944. \font\chapit=cmti12 scaled \magstep2
  945. \font\chapsl=cmsl12 scaled \magstep2
  946. \font\chaptt=cmtt12 scaled \magstep2
  947. \font\chapsf=cmss12 scaled \magstep2
  948. \let\chapbf=\chaprm
  949. \font\chapsc=cmcsc10 scaled\magstep3
  950. \font\chapi=cmmi12 scaled \magstep2
  951. \font\chapsy=cmsy10 scaled \magstep3
  952.  
  953. \font\secrm=cmbx12 scaled \magstep1
  954. \font\secit=cmti12 scaled \magstep1
  955. \font\secsl=cmsl12 scaled \magstep1
  956. \font\sectt=cmtt12 scaled \magstep1
  957. \font\secsf=cmss12 scaled \magstep1
  958. \font\secbf=cmbx12 scaled \magstep1
  959. \font\secsc=cmcsc10 scaled\magstep2
  960. \font\seci=cmmi12 scaled \magstep1
  961. \font\secsy=cmsy10 scaled \magstep2
  962.  
  963. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  964. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  965. % \font\ssecsl=cmsl10 scaled \magstep1
  966. % \font\ssectt=cmtt10 scaled \magstep1
  967. % \font\ssecsf=cmss10 scaled \magstep1
  968.  
  969. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  970. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  971. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  972. %\font\ssectt=cmtt10 scaled 1315
  973. %\font\ssecsf=cmss10 scaled 1315
  974.  
  975. %\let\ssecbf=\ssecrm
  976.  
  977. \font\ssecrm=cmbx12 scaled \magstephalf
  978. \font\ssecit=cmti12 scaled \magstephalf
  979. \font\ssecsl=cmsl12 scaled \magstephalf
  980. \font\ssectt=cmtt12 scaled \magstephalf
  981. \font\ssecsf=cmss12 scaled \magstephalf
  982. \font\ssecbf=cmbx12 scaled \magstephalf
  983. \font\ssecsc=cmcsc10 scaled \magstep1
  984. \font\sseci=cmmi12 scaled \magstephalf
  985. \font\ssecsy=cmsy10 scaled \magstep1
  986. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  987. % but that is not a standard magnification.
  988.  
  989. % Fonts for title page:
  990. \font\titlerm = cmbx12 scaled \magstep3
  991. \let\authorrm = \secrm
  992.  
  993. % In order for the font changes to affect most math symbols and letters,
  994. % we have to define the \textfont of the standard families.  Since
  995. % texinfo doesn't allow for producing subscripts and superscripts, we
  996. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  997. % also require loading a lot more fonts).
  998. %
  999. \def\resetmathfonts{%
  1000.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  1001.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  1002.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  1003. }
  1004.  
  1005.  
  1006. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  1007. % of just \STYLE.  We do this so that font changes will continue to work
  1008. % in math mode, where it is the current \fam that is relevant in most
  1009. % cases, not the current.  Plain TeX does, for example,
  1010. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  1011. % to redefine \bf itself.
  1012. \def\textfonts{%
  1013.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  1014.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  1015.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  1016.   \resetmathfonts}
  1017. \def\chapfonts{%
  1018.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  1019.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  1020.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  1021.   \resetmathfonts}
  1022. \def\secfonts{%
  1023.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  1024.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  1025.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  1026.   \resetmathfonts}
  1027. \def\subsecfonts{%
  1028.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  1029.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  1030.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  1031.   \resetmathfonts}
  1032. \def\indexfonts{%
  1033.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  1034.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  1035.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  1036.   \resetmathfonts}
  1037.  
  1038. % Set up the default fonts, so we can use them for creating boxes.
  1039. %
  1040. \textfonts
  1041.  
  1042. % Count depth in font-changes, for error checks
  1043. \newcount\fontdepth \fontdepth=0
  1044.  
  1045. % Fonts for short table of contents.
  1046. \font\shortcontrm=cmr12
  1047. \font\shortcontbf=cmbx12
  1048. \font\shortcontsl=cmsl12
  1049.  
  1050. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  1051. %% serif) and @ii for TeX italic
  1052.  
  1053. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  1054. % unless the following character is such as not to need one.
  1055. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  1056. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  1057.  
  1058. \let\i=\smartitalic
  1059. \let\var=\smartitalic
  1060. \let\dfn=\smartitalic
  1061. \let\emph=\smartitalic
  1062. \let\cite=\smartitalic
  1063.  
  1064. \def\b#1{{\bf #1}}
  1065. \let\strong=\b
  1066.  
  1067. % We can't just use \exhyphenpenalty, because that only has effect at
  1068. % the end of a paragraph.  Restore normal hyphenation at the end of the
  1069. % group within which \nohyphenation is presumably called.
  1070. %
  1071. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  1072. \def\restorehyphenation{\hyphenchar\font = `- }
  1073.  
  1074. \def\t#1{%
  1075.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  1076.   \null
  1077. }
  1078. \let\ttfont = \t
  1079. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  1080. \def\samp #1{`\tclose{#1}'\null}
  1081. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  1082. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  1083.  
  1084. \let\file=\samp
  1085.  
  1086. % @code is a modification of @t,
  1087. % which makes spaces the same size as normal in the surrounding text.
  1088. \def\tclose#1{%
  1089.   {%
  1090.     % Change normal interword space to be same as for the current font.
  1091.     \spaceskip = \fontdimen2\font
  1092.     %
  1093.     % Switch to typewriter.
  1094.     \tt
  1095.     %
  1096.     % But `\ ' produces the large typewriter interword space.
  1097.     \def\ {{\spaceskip = 0pt{} }}%
  1098.     %
  1099.     % Turn off hyphenation.
  1100.     \nohyphenation
  1101.     %
  1102.     \rawbackslash
  1103.     \frenchspacing
  1104.     #1%
  1105.   }%
  1106.   \null
  1107. }
  1108.  
  1109. % We *must* turn on hyphenation at `-' and `_' in \code.
  1110. % Otherwise, it is too hard to avoid overful hboxes
  1111. % in the Emacs manual, the Library manual, etc.
  1112.  
  1113. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  1114. % both hyphenation at - and hyphenation within words.
  1115. % We must therefore turn them both off (\tclose does that)
  1116. % and arrange explicitly to hyphenate an a dash.
  1117. %  -- rms.
  1118. {
  1119. \catcode`\-=\active
  1120. \catcode`\_=\active
  1121. \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
  1122. % The following is used by \doprintindex to insure that long function names
  1123. % wrap around.  It is necessary for - and _ to be active before the index is
  1124. % read from the file, as \entry parses the arguments long before \code is
  1125. % ever called.  -- mycroft
  1126. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
  1127. }
  1128. \def\realdash{-}
  1129. \def\realunder{_}
  1130. \def\codedash{-\discretionary{}{}{}}
  1131. \def\codeunder{\normalunderscore\discretionary{}{}{}}
  1132. \def\codex #1{\tclose{#1}\endgroup}
  1133.  
  1134. %\let\exp=\tclose  %Was temporary
  1135.  
  1136. % @kbd is like @code, except that if the argument is just one @key command,
  1137. % then @kbd has no effect.
  1138.  
  1139. \def\xkey{\key}
  1140. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  1141. \ifx\one\xkey\ifx\threex\three \key{#2}%
  1142. \else\tclose{\look}\fi
  1143. \else\tclose{\look}\fi}
  1144.  
  1145. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  1146. % argument is to make the input look right: @dmn{pt} instead of
  1147. % @dmn{}pt.
  1148. %
  1149. \def\dmn#1{\thinspace #1}
  1150.  
  1151. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  1152.  
  1153. \def\l#1{{\li #1}\null}        %
  1154.  
  1155. \def\r#1{{\rm #1}}        % roman font
  1156. % Use of \lowercase was suggested.
  1157. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  1158. \def\ii#1{{\it #1}}        % italic font
  1159.  
  1160. \message{page headings,}
  1161.  
  1162. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  1163. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  1164.  
  1165. % First the title page.  Must do @settitle before @titlepage.
  1166. \def\titlefont#1{{\titlerm #1}}
  1167.  
  1168. \newif\ifseenauthor
  1169. \newif\iffinishedtitlepage
  1170.  
  1171. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  1172. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  1173.     \endgroup\page\hbox{}\page}
  1174.  
  1175. \def\titlepage{\begingroup \parindent=0pt \textfonts
  1176.    \let\subtitlerm=\tenrm
  1177. % I deinstalled the following change because \cmr12 is undefined.
  1178. % This change was not in the ChangeLog anyway.  --rms.
  1179. %   \let\subtitlerm=\cmr12
  1180.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  1181.    %
  1182.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  1183.    %
  1184.    % Leave some space at the very top of the page.
  1185.    \vglue\titlepagetopglue
  1186.    %
  1187.    % Now you can print the title using @title.
  1188.    \def\title{\parsearg\titlezzz}%
  1189.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  1190.             % print a rule at the page bottom also.
  1191.             \finishedtitlepagefalse
  1192.             \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  1193.    % No rule at page bottom unless we print one at the top with @title.
  1194.    \finishedtitlepagetrue
  1195.    %
  1196.    % Now you can put text using @subtitle.
  1197.    \def\subtitle{\parsearg\subtitlezzz}%
  1198.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  1199.    %
  1200.    % @author should come last, but may come many times.
  1201.    \def\author{\parsearg\authorzzz}%
  1202.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  1203.       {\authorfont \leftline{##1}}}%
  1204.    %
  1205.    % Most title ``pages'' are actually two pages long, with space
  1206.    % at the top of the second.  We don't want the ragged left on the second.
  1207.    \let\oldpage = \page
  1208.    \def\page{%
  1209.       \iffinishedtitlepage\else
  1210.      \finishtitlepage
  1211.       \fi
  1212.       \oldpage
  1213.       \let\page = \oldpage
  1214.       \hbox{}}%
  1215. %   \def\page{\oldpage \hbox{}}
  1216. }
  1217.  
  1218. \def\Etitlepage{%
  1219.    \iffinishedtitlepage\else
  1220.       \finishtitlepage
  1221.    \fi
  1222.    % It is important to do the page break before ending the group,
  1223.    % because the headline and footline are only empty inside the group.
  1224.    % If we use the new definition of \page, we always get a blank page
  1225.    % after the title page, which we certainly don't want.
  1226.    \oldpage
  1227.    \endgroup
  1228.    \HEADINGSon
  1229. }
  1230.  
  1231. \def\finishtitlepage{%
  1232.    \vskip4pt \hrule height 2pt width \hsize
  1233.    \vskip\titlepagebottomglue
  1234.    \finishedtitlepagetrue
  1235. }
  1236.  
  1237. %%% Set up page headings and footings.
  1238.  
  1239. \let\thispage=\folio
  1240.  
  1241. \newtoks \evenheadline    % Token sequence for heading line of even pages
  1242. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  1243. \newtoks \evenfootline    % Token sequence for footing line of even pages
  1244. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  1245.  
  1246. % Now make Tex use those variables
  1247. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  1248.                             \else \the\evenheadline \fi}}
  1249. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  1250.                             \else \the\evenfootline \fi}\HEADINGShook}
  1251. \let\HEADINGShook=\relax
  1252.  
  1253. % Commands to set those variables.
  1254. % For example, this is what  @headings on  does
  1255. % @evenheading @thistitle|@thispage|@thischapter
  1256. % @oddheading @thischapter|@thispage|@thistitle
  1257. % @evenfooting @thisfile||
  1258. % @oddfooting ||@thisfile
  1259.  
  1260. \def\evenheading{\parsearg\evenheadingxxx}
  1261. \def\oddheading{\parsearg\oddheadingxxx}
  1262. \def\everyheading{\parsearg\everyheadingxxx}
  1263.  
  1264. \def\evenfooting{\parsearg\evenfootingxxx}
  1265. \def\oddfooting{\parsearg\oddfootingxxx}
  1266. \def\everyfooting{\parsearg\everyfootingxxx}
  1267.  
  1268. {\catcode`\@=0 %
  1269.  
  1270. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  1271. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  1272. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1273.  
  1274. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  1275. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  1276. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1277.  
  1278. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  1279. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  1280. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  1281. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1282.  
  1283. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1284. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1285. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1286.  
  1287. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1288. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1289. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1290.  
  1291. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  1292. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  1293. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  1294. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1295. %
  1296. }% unbind the catcode of @.
  1297.  
  1298. % @headings double    turns headings on for double-sided printing.
  1299. % @headings single    turns headings on for single-sided printing.
  1300. % @headings off        turns them off.
  1301. % @headings on        same as @headings double, retained for compatibility.
  1302. % @headings after    turns on double-sided headings after this page.
  1303. % @headings doubleafter    turns on double-sided headings after this page.
  1304. % @headings singleafter turns on single-sided headings after this page.
  1305. % By default, they are off.
  1306.  
  1307. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1308.  
  1309. \def\HEADINGSoff{
  1310. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1311. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1312. \HEADINGSoff
  1313. % When we turn headings on, set the page number to 1.
  1314. % For double-sided printing, put current file name in lower left corner,
  1315. % chapter name on inside top of right hand pages, document
  1316. % title on inside top of left hand pages, and page numbers on outside top
  1317. % edge of all pages.
  1318. \def\HEADINGSdouble{
  1319. %\pagealignmacro
  1320. \global\pageno=1
  1321. \global\evenfootline={\hfil}
  1322. \global\oddfootline={\hfil}
  1323. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1324. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1325. }
  1326. % For single-sided printing, chapter title goes across top left of page,
  1327. % page number on top right.
  1328. \def\HEADINGSsingle{
  1329. %\pagealignmacro
  1330. \global\pageno=1
  1331. \global\evenfootline={\hfil}
  1332. \global\oddfootline={\hfil}
  1333. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1334. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1335. }
  1336. \def\HEADINGSon{\HEADINGSdouble}
  1337.  
  1338. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1339. \let\HEADINGSdoubleafter=\HEADINGSafter
  1340. \def\HEADINGSdoublex{%
  1341. \global\evenfootline={\hfil}
  1342. \global\oddfootline={\hfil}
  1343. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1344. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1345. }
  1346.  
  1347. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1348. \def\HEADINGSsinglex{%
  1349. \global\evenfootline={\hfil}
  1350. \global\oddfootline={\hfil}
  1351. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1352. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1353. }
  1354.  
  1355. % Subroutines used in generating headings
  1356. % Produces Day Month Year style of output.
  1357. \def\today{\number\day\space
  1358. \ifcase\month\or
  1359. January\or February\or March\or April\or May\or June\or
  1360. July\or August\or September\or October\or November\or December\fi
  1361. \space\number\year}
  1362.  
  1363. % Use this if you want the Month Day, Year style of output.
  1364. %\def\today{\ifcase\month\or
  1365. %January\or February\or March\or April\or May\or June\or
  1366. %July\or August\or September\or October\or November\or December\fi
  1367. %\space\number\day, \number\year}
  1368.  
  1369. % @settitle line...  specifies the title of the document, for headings
  1370. % It generates no output of its own
  1371.  
  1372. \def\thistitle{No Title}
  1373. \def\settitle{\parsearg\settitlezzz}
  1374. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1375.  
  1376. \message{tables,}
  1377.  
  1378. % @tabs -- simple alignment
  1379.  
  1380. % These don't work.  For one thing, \+ is defined as outer.
  1381. % So these macros cannot even be defined.
  1382.  
  1383. %\def\tabs{\parsearg\tabszzz}
  1384. %\def\tabszzz #1{\settabs\+#1\cr}
  1385. %\def\tabline{\parsearg\tablinezzz}
  1386. %\def\tablinezzz #1{\+#1\cr}
  1387. %\def\&{&}
  1388.  
  1389. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1390.  
  1391. % default indentation of table text
  1392. \newdimen\tableindent \tableindent=.8in
  1393. % default indentation of @itemize and @enumerate text
  1394. \newdimen\itemindent  \itemindent=.3in
  1395. % margin between end of table item and start of table text.
  1396. \newdimen\itemmargin  \itemmargin=.1in
  1397.  
  1398. % used internally for \itemindent minus \itemmargin
  1399. \newdimen\itemmax
  1400.  
  1401. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1402. % these defs.
  1403. % They also define \itemindex
  1404. % to index the item name in whatever manner is desired (perhaps none).
  1405.  
  1406. \newif\ifitemxneedsnegativevskip
  1407.  
  1408. \def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
  1409.  
  1410. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1411. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1412.  
  1413. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1414. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1415.  
  1416. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1417. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1418.  
  1419. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1420.                  \itemzzz {#1}}
  1421.  
  1422. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1423.                  \itemzzz {#1}}
  1424.  
  1425. \def\itemzzz #1{\begingroup %
  1426.   \advance\hsize by -\rightskip
  1427.   \advance\hsize by -\tableindent
  1428.   \setbox0=\hbox{\itemfont{#1}}%
  1429.   \itemindex{#1}%
  1430.   \nobreak % This prevents a break before @itemx.
  1431.   %
  1432.   % Be sure we are not still in the middle of a paragraph.
  1433.   %{\parskip = 0in
  1434.   %\par
  1435.   %}%
  1436.   %
  1437.   % If the item text does not fit in the space we have, put it on a line
  1438.   % by itself, and do not allow a page break either before or after that
  1439.   % line.  We do not start a paragraph here because then if the next
  1440.   % command is, e.g., @kindex, the whatsit would get put into the
  1441.   % horizontal list on a line by itself, resulting in extra blank space.
  1442.   \ifdim \wd0>\itemmax
  1443.     %
  1444.     % Make this a paragraph so we get the \parskip glue and wrapping,
  1445.     % but leave it ragged-right.
  1446.     \begingroup
  1447.       \advance\leftskip by-\tableindent
  1448.       \advance\hsize by\tableindent
  1449.       \advance\rightskip by0pt plus1fil
  1450.       \leavevmode\unhbox0\par
  1451.     \endgroup
  1452.     %
  1453.     % We're going to be starting a paragraph, but we don't want the
  1454.     % \parskip glue -- logically it's part of the @item we just started.
  1455.     \nobreak \vskip-\parskip
  1456.     %
  1457.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1458.     % we can't prevent a possible page break at the following
  1459.     % \baselineskip glue.
  1460.     \nobreak
  1461.     \endgroup
  1462.     \itemxneedsnegativevskipfalse
  1463.   \else
  1464.     % The item text fits into the space.  Start a paragraph, so that the
  1465.     % following text (if any) will end up on the same line.  Since that
  1466.     % text will be indented by \tableindent, we make the item text be in
  1467.     % a zero-width box.
  1468.     \noindent
  1469.     \rlap{\hskip -\tableindent\box0}\ignorespaces%
  1470.     \endgroup%
  1471.     \itemxneedsnegativevskiptrue%
  1472.   \fi
  1473. }
  1474.  
  1475. \def\item{\errmessage{@item while not in a table}}
  1476. \def\itemx{\errmessage{@itemx while not in a table}}
  1477. \def\kitem{\errmessage{@kitem while not in a table}}
  1478. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1479. \def\xitem{\errmessage{@xitem while not in a table}}
  1480. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1481.  
  1482. %% Contains a kludge to get @end[description] to work
  1483. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1484.  
  1485. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1486. {\obeylines\obeyspaces%
  1487. \gdef\tablex #1^^M{%
  1488. \tabley\dontindex#1        \endtabley}}
  1489.  
  1490. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1491. {\obeylines\obeyspaces%
  1492. \gdef\ftablex #1^^M{%
  1493. \tabley\fnitemindex#1        \endtabley
  1494. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1495. \let\Etable=\relax}}
  1496.  
  1497. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1498. {\obeylines\obeyspaces%
  1499. \gdef\vtablex #1^^M{%
  1500. \tabley\vritemindex#1        \endtabley
  1501. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1502. \let\Etable=\relax}}
  1503.  
  1504. \def\dontindex #1{}
  1505. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1506. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1507.  
  1508. {\obeyspaces %
  1509. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1510. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1511.  
  1512. \def\tablez #1#2#3#4#5#6{%
  1513. \aboveenvbreak %
  1514. \begingroup %
  1515. \def\Edescription{\Etable}% Neccessary kludge.
  1516. \let\itemindex=#1%
  1517. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1518. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1519. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1520. \def\itemfont{#2}%
  1521. \itemmax=\tableindent %
  1522. \advance \itemmax by -\itemmargin %
  1523. \advance \leftskip by \tableindent %
  1524. \exdentamount=\tableindent
  1525. \parindent = 0pt
  1526. \parskip = \smallskipamount
  1527. \ifdim \parskip=0pt \parskip=2pt \fi%
  1528. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1529. \let\item = \internalBitem %
  1530. \let\itemx = \internalBitemx %
  1531. \let\kitem = \internalBkitem %
  1532. \let\kitemx = \internalBkitemx %
  1533. \let\xitem = \internalBxitem %
  1534. \let\xitemx = \internalBxitemx %
  1535. }
  1536.  
  1537. % This is the counter used by @enumerate, which is really @itemize
  1538.  
  1539. \newcount \itemno
  1540.  
  1541. \def\itemize{\parsearg\itemizezzz}
  1542.  
  1543. \def\itemizezzz #1{%
  1544.   \begingroup % ended by the @end itemsize
  1545.   \itemizey {#1}{\Eitemize}
  1546. }
  1547.  
  1548. \def\itemizey #1#2{%
  1549. \aboveenvbreak %
  1550. \itemmax=\itemindent %
  1551. \advance \itemmax by -\itemmargin %
  1552. \advance \leftskip by \itemindent %
  1553. \exdentamount=\itemindent
  1554. \parindent = 0pt %
  1555. \parskip = \smallskipamount %
  1556. \ifdim \parskip=0pt \parskip=2pt \fi%
  1557. \def#2{\endgraf\afterenvbreak\endgroup}%
  1558. \def\itemcontents{#1}%
  1559. \let\item=\itemizeitem}
  1560.  
  1561. % Set sfcode to normal for the chars that usually have another value.
  1562. % These are `.?!:;,'
  1563. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1564.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1565.  
  1566. % \splitoff TOKENS\endmark defines \first to be the first token in
  1567. % TOKENS, and \rest to be the remainder.
  1568. %
  1569. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1570.  
  1571. % Allow an optional argument of an uppercase letter, lowercase letter,
  1572. % or number, to specify the first label in the enumerated list.  No
  1573. % argument is the same as `1'.
  1574. %
  1575. \def\enumerate{\parsearg\enumeratezzz}
  1576. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1577. \def\enumeratey #1 #2\endenumeratey{%
  1578.   \begingroup % ended by the @end enumerate
  1579.   %
  1580.   % If we were given no argument, pretend we were given `1'.
  1581.   \def\thearg{#1}%
  1582.   \ifx\thearg\empty \def\thearg{1}\fi
  1583.   %
  1584.   % Detect if the argument is a single token.  If so, it might be a
  1585.   % letter.  Otherwise, the only valid thing it can be is a number.
  1586.   % (We will always have one token, because of the test we just made.
  1587.   % This is a good thing, since \splitoff doesn't work given nothing at
  1588.   % all -- the first parameter is undelimited.)
  1589.   \expandafter\splitoff\thearg\endmark
  1590.   \ifx\rest\empty
  1591.     % Only one token in the argument.  It could still be anything.
  1592.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1593.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1594.     %   not equal to itself.
  1595.     % Otherwise, we assume it's a number.
  1596.     %
  1597.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1598.     % continuing to look for a <number>.
  1599.     %
  1600.     \ifnum\lccode\expandafter`\thearg=0\relax
  1601.       \numericenumerate % a number (we hope)
  1602.     \else
  1603.       % It's a letter.
  1604.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1605.         \lowercaseenumerate % lowercase letter
  1606.       \else
  1607.         \uppercaseenumerate % uppercase letter
  1608.       \fi
  1609.     \fi
  1610.   \else
  1611.     % Multiple tokens in the argument.  We hope it's a number.
  1612.     \numericenumerate
  1613.   \fi
  1614. }
  1615.  
  1616. % An @enumerate whose labels are integers.  The starting integer is
  1617. % given in \thearg.
  1618. %
  1619. \def\numericenumerate{%
  1620.   \itemno = \thearg
  1621.   \startenumeration{\the\itemno}%
  1622. }
  1623.  
  1624. % The starting (lowercase) letter is in \thearg.
  1625. \def\lowercaseenumerate{%
  1626.   \itemno = \expandafter`\thearg
  1627.   \startenumeration{%
  1628.     % Be sure we're not beyond the end of the alphabet.
  1629.     \ifnum\itemno=0
  1630.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1631.                   alphabet}%
  1632.     \fi
  1633.     \char\lccode\itemno
  1634.   }%
  1635. }
  1636.  
  1637. % The starting (uppercase) letter is in \thearg.
  1638. \def\uppercaseenumerate{%
  1639.   \itemno = \expandafter`\thearg
  1640.   \startenumeration{%
  1641.     % Be sure we're not beyond the end of the alphabet.
  1642.     \ifnum\itemno=0
  1643.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1644.                   alphabet}
  1645.     \fi
  1646.     \char\uccode\itemno
  1647.   }%
  1648. }
  1649.  
  1650. % Call itemizey, adding a period to the first argument and supplying the
  1651. % common last two arguments.  Also subtract one from the initial value in
  1652. % \itemno, since @item increments \itemno.
  1653. %
  1654. \def\startenumeration#1{%
  1655.   \advance\itemno by -1
  1656.   \itemizey{#1.}\Eenumerate\flushcr
  1657. }
  1658.  
  1659. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1660. % to @enumerate.
  1661. %
  1662. \def\alphaenumerate{\enumerate{a}}
  1663. \def\capsenumerate{\enumerate{A}}
  1664. \def\Ealphaenumerate{\Eenumerate}
  1665. \def\Ecapsenumerate{\Eenumerate}
  1666.  
  1667. % Definition of @item while inside @itemize.
  1668.  
  1669. \def\itemizeitem{%
  1670. \advance\itemno by 1
  1671. {\let\par=\endgraf \smallbreak}%
  1672. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1673. {\parskip=0in \hskip 0pt
  1674. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1675. \vadjust{\penalty 1200}}%
  1676. \flushcr}
  1677.  
  1678. % @multitable macros
  1679. % Amy Hendrickson, 8/18/94
  1680. %
  1681. % @multitable ... @endmultitable will make as many columns as desired.
  1682. % Contents of each column will wrap at width given in preamble. Width
  1683. % can be specified either with sample text given in a template line,
  1684. % or in percent of \hsize, the current width of text on page.
  1685.  
  1686. % Table can continue over pages but will only break between lines.
  1687.  
  1688. % To make preamble:
  1689. %
  1690. % Either define widths of columns in terms of percent of \hsize: 
  1691. %   @multitable @percentofhsize .2 .3 .5
  1692. %   @item ...
  1693. %
  1694. %   Numbers following @percentofhsize are the percent of the total
  1695. %   current hsize to be used for each column. You may use as many
  1696. %   columns as desired.
  1697.  
  1698. % Or use a template:
  1699. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1700. %   @item ...
  1701. %   using the widest term desired in each column.
  1702.  
  1703.  
  1704. % Each new table line starts with @item, each subsequent new column 
  1705. % starts with @tab. Empty columns may be produced by supplying @tab's
  1706. % with nothing between them for as many times as empty columns are needed,
  1707. % ie, @tab@tab@tab will produce two empty columns.
  1708.  
  1709. % @item, @tab, @multicolumn or @endmulticolumn do not need to be on their
  1710. % own lines, but it will not hurt if they are.
  1711.  
  1712. % Sample multitable:
  1713.  
  1714. %   @multitable {Column 1 template} {Column 2 template} {Column 3 template}
  1715. %   @item first col stuff @tab second col stuff @tab third col
  1716. %   @item 
  1717. %   first col stuff 
  1718. %   @tab 
  1719. %   second col stuff 
  1720. %   @tab 
  1721. %   third col 
  1722. %   @item first col stuff @tab second col stuff 
  1723. %   @tab Many paragraphs of text may be used in any column.
  1724. %     
  1725. %         They will wrap at the width determined by the template.
  1726. %   @item@tab@tab This will be in third column.
  1727. %   @endmultitable
  1728.  
  1729. % Default dimensions may be reset by user.
  1730. % @intableparskip will set vertical space between paragraphs in table.
  1731. % @intableparindent will set paragraph indent in table.
  1732. % @spacebetweencols will set horizontal space to be left between columns.
  1733. % @spacebetweenlines will set vertical space to be left between lines.
  1734.  
  1735. %%%%
  1736. % Dimensions 
  1737.  
  1738. \newdimen\intableparskip
  1739. \newdimen\intableparindent
  1740. \newdimen\spacebetweencols
  1741. \newdimen\spacebetweenlines
  1742. \intableparskip=0pt
  1743. \intableparindent=6pt
  1744. \spacebetweencols=12pt
  1745. \spacebetweenlines=12pt
  1746.  
  1747. %%%%
  1748. % Macros used to set up halign preamble:
  1749. \let\endsetuptable\relax
  1750. \def\xendsetuptable{\endsetuptable}
  1751. \let\percentofhsize\relax
  1752. \def\xpercentofhsize{\percentofhsize}
  1753. \newif\ifsetpercent
  1754.  
  1755. \newcount\colcount
  1756. \def\setuptable#1{\def\firstarg{#1}%
  1757. \ifx\firstarg\xendsetuptable\let\go\relax%
  1758. \else
  1759.   \ifx\firstarg\xpercentofhsize\global\setpercenttrue%
  1760.   \else
  1761.     \ifsetpercent
  1762.        \if#1.\else%
  1763.        \global\advance\colcount by1 %
  1764.        \expandafter\xdef\csname col\the\colcount\endcsname{.#1\hsize}%
  1765.        \fi
  1766.     \else
  1767.        \global\advance\colcount by1
  1768.        \setbox0=\hbox{#1}%
  1769.        \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}%
  1770.     \fi%
  1771.   \fi%
  1772.   \let\go\setuptable%
  1773. \fi\go}
  1774. %%%%
  1775. % multitable syntax
  1776. \def\tab{&}
  1777.  
  1778. %%%%
  1779. % @multitable ... @endmultitable definitions:
  1780.  
  1781. \def\multitable#1\item{\bgroup
  1782. \let\item\cr
  1783. \tolerance=9500
  1784. \hbadness=9500
  1785. \parskip=\intableparskip
  1786. \parindent=\intableparindent
  1787. \overfullrule=0pt
  1788. \global\colcount=0\relax%
  1789. \def\Emultitable{\global\setpercentfalse\global\everycr{}\cr\egroup\egroup}%
  1790.  % To parse everything between @multitable and @item :
  1791. \def\one{#1}\expandafter\setuptable\one\endsetuptable
  1792.  % Need to reset this to 0 after \setuptable.
  1793. \global\colcount=0\relax% 
  1794.  %
  1795.  % This preamble sets up a generic column definition, which will
  1796.  % be used as many times as user calls for columns.
  1797.  % \vtop will set a single line and will also let text wrap and 
  1798.  % continue for many paragraphs if desired.
  1799. \halign\bgroup&\global\advance\colcount by 1\relax%
  1800. \vtop{\hsize=\expandafter\csname col\the\colcount\endcsname
  1801.  % In order to keep entries from bumping into each other
  1802.  % we will add a \leftskip of \spacebetweencols to all columns after
  1803.  % the first one.
  1804.  %  If a template has been used, we will add \spacebetweencols 
  1805.  % to the width of each template entry.
  1806.  %  If user has set preamble in terms of percent of \hsize
  1807.  % we will use that dimension as the width of the column, and
  1808.  % the \leftskip will keep entries from bumping into each other.
  1809.  % Table will start at left margin and final column will justify at
  1810.  % right margin.
  1811. \ifnum\colcount=1
  1812. \else
  1813.   \ifsetpercent
  1814.   \else
  1815.    % If user has <not> set preamble in terms of percent of \hsize
  1816.    % we will advance \hsize by \spacebetweencols 
  1817.   \advance\hsize by \spacebetweencols
  1818.   \fi
  1819.  % In either case we will make \leftskip=\spacebetweencols:
  1820. \leftskip=\spacebetweencols
  1821. \fi
  1822. \noindent##}\cr%
  1823.  % \everycr will reset column counter, \colcount, at the end of
  1824.  % each line. Every column  entry will cause \colcount to advance by one. 
  1825.  % The table preamble
  1826.  % looks at the current \colcount to find the correct column width.
  1827. \global\everycr{\noalign{\nointerlineskip\vskip\spacebetweenlines
  1828. \filbreak%% keeps underfull box messages off when table breaks over pages.
  1829. \global\colcount=0\relax}}}
  1830.  
  1831. \message{indexing,}
  1832. % Index generation facilities
  1833.  
  1834. % Define \newwrite to be identical to plain tex's \newwrite
  1835. % except not \outer, so it can be used within \newindex.
  1836. {\catcode`\@=11
  1837. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1838.  
  1839. % \newindex {foo} defines an index named foo.
  1840. % It automatically defines \fooindex such that
  1841. % \fooindex ...rest of line... puts an entry in the index foo.
  1842. % It also defines \fooindfile to be the number of the output channel for
  1843. % the file that    accumulates this index.  The file's extension is foo.
  1844. % The name of an index should be no more than 2 characters long
  1845. % for the sake of vms.
  1846.  
  1847. \def\newindex #1{
  1848. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1849. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1850. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1851. \noexpand\doindex {#1}}
  1852. }
  1853.  
  1854. % @defindex foo  ==  \newindex{foo}
  1855.  
  1856. \def\defindex{\parsearg\newindex}
  1857.  
  1858. % Define @defcodeindex, like @defindex except put all entries in @code.
  1859.  
  1860. \def\newcodeindex #1{
  1861. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1862. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1863. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1864. \noexpand\docodeindex {#1}}
  1865. }
  1866.  
  1867. \def\defcodeindex{\parsearg\newcodeindex}
  1868.  
  1869. % @synindex foo bar    makes index foo feed into index bar.
  1870. % Do this instead of @defindex foo if you don't want it as a separate index.
  1871. \def\synindex #1 #2 {%
  1872. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1873. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1874. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1875. \noexpand\doindex {#2}}%
  1876. }
  1877.  
  1878. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1879. % inside @code.
  1880. \def\syncodeindex #1 #2 {%
  1881. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1882. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1883. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1884. \noexpand\docodeindex {#2}}%
  1885. }
  1886.  
  1887. % Define \doindex, the driver for all \fooindex macros.
  1888. % Argument #1 is generated by the calling \fooindex macro,
  1889. %  and it is "foo", the name of the index.
  1890.  
  1891. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1892. % This is because \doind is more useful to call from other macros.
  1893.  
  1894. % There is also \dosubind {index}{topic}{subtopic}
  1895. % which makes an entry in a two-level index such as the operation index.
  1896.  
  1897. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1898. \def\singleindexer #1{\doind{\indexname}{#1}}
  1899.  
  1900. % like the previous two, but they put @code around the argument.
  1901. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1902. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1903.  
  1904. \def\indexdummies{%
  1905. % Take care of the plain tex accent commands.
  1906. \def\"{\realbackslash "}%
  1907. \def\`{\realbackslash `}%
  1908. \def\'{\realbackslash '}%
  1909. \def\^{\realbackslash ^}%
  1910. \def\~{\realbackslash ~}%
  1911. \def\={\realbackslash =}%
  1912. \def\b{\realbackslash b}%
  1913. \def\c{\realbackslash c}%
  1914. \def\d{\realbackslash d}%
  1915. \def\u{\realbackslash u}%
  1916. \def\v{\realbackslash v}%
  1917. \def\H{\realbackslash H}%
  1918. % Take care of the plain tex special European modified letters.
  1919. \def\oe{\realbackslash oe}%
  1920. \def\ae{\realbackslash ae}%
  1921. \def\aa{\realbackslash aa}%
  1922. \def\OE{\realbackslash OE}%
  1923. \def\AE{\realbackslash AE}%
  1924. \def\AA{\realbackslash AA}%
  1925. \def\o{\realbackslash o}%
  1926. \def\O{\realbackslash O}%
  1927. \def\l{\realbackslash l}%
  1928. \def\L{\realbackslash L}%
  1929. \def\ss{\realbackslash ss}%
  1930. % Take care of texinfo commands likely to appear in an index entry.
  1931. \def\_{{\realbackslash _}}%
  1932. \def\w{\realbackslash w }%
  1933. \def\bf{\realbackslash bf }%
  1934. \def\rm{\realbackslash rm }%
  1935. \def\sl{\realbackslash sl }%
  1936. \def\sf{\realbackslash sf}%
  1937. \def\tt{\realbackslash tt}%
  1938. \def\gtr{\realbackslash gtr}%
  1939. \def\less{\realbackslash less}%
  1940. \def\hat{\realbackslash hat}%
  1941. \def\char{\realbackslash char}%
  1942. \def\TeX{\realbackslash TeX}%
  1943. \def\dots{\realbackslash dots }%
  1944. \def\copyright{\realbackslash copyright }%
  1945. \def\tclose##1{\realbackslash tclose {##1}}%
  1946. \def\code##1{\realbackslash code {##1}}%
  1947. \def\samp##1{\realbackslash samp {##1}}%
  1948. \def\t##1{\realbackslash r {##1}}%
  1949. \def\r##1{\realbackslash r {##1}}%
  1950. \def\i##1{\realbackslash i {##1}}%
  1951. \def\b##1{\realbackslash b {##1}}%
  1952. \def\cite##1{\realbackslash cite {##1}}%
  1953. \def\key##1{\realbackslash key {##1}}%
  1954. \def\file##1{\realbackslash file {##1}}%
  1955. \def\var##1{\realbackslash var {##1}}%
  1956. \def\kbd##1{\realbackslash kbd {##1}}%
  1957. \def\dfn##1{\realbackslash dfn {##1}}%
  1958. \def\emph##1{\realbackslash emph {##1}}%
  1959. }
  1960.  
  1961. % \indexnofonts no-ops all font-change commands.
  1962. % This is used when outputting the strings to sort the index by.
  1963. \def\indexdummyfont#1{#1}
  1964. \def\indexdummytex{TeX}
  1965. \def\indexdummydots{...}
  1966.  
  1967. \def\indexnofonts{%
  1968. % Just ignore accents.
  1969. \let\"=\indexdummyfont
  1970. \let\`=\indexdummyfont
  1971. \let\'=\indexdummyfont
  1972. \let\^=\indexdummyfont
  1973. \let\~=\indexdummyfont
  1974. \let\==\indexdummyfont
  1975. \let\b=\indexdummyfont
  1976. \let\c=\indexdummyfont
  1977. \let\d=\indexdummyfont
  1978. \let\u=\indexdummyfont
  1979. \let\v=\indexdummyfont
  1980. \let\H=\indexdummyfont
  1981. % Take care of the plain tex special European modified letters.
  1982. \def\oe{oe}%
  1983. \def\ae{ae}%
  1984. \def\aa{aa}%
  1985. \def\OE{OE}%
  1986. \def\AE{AE}%
  1987. \def\AA{AA}%
  1988. \def\o{o}%
  1989. \def\O{O}%
  1990. \def\l{l}%
  1991. \def\L{L}%
  1992. \def\ss{ss}%
  1993. \let\w=\indexdummyfont
  1994. \let\t=\indexdummyfont
  1995. \let\r=\indexdummyfont
  1996. \let\i=\indexdummyfont
  1997. \let\b=\indexdummyfont
  1998. \let\emph=\indexdummyfont
  1999. \let\strong=\indexdummyfont
  2000. \let\cite=\indexdummyfont
  2001. \let\sc=\indexdummyfont
  2002. %Don't no-op \tt, since it isn't a user-level command
  2003. % and is used in the definitions of the active chars like <, >, |...
  2004. %\let\tt=\indexdummyfont
  2005. \let\tclose=\indexdummyfont
  2006. \let\code=\indexdummyfont
  2007. \let\file=\indexdummyfont
  2008. \let\samp=\indexdummyfont
  2009. \let\kbd=\indexdummyfont
  2010. \let\key=\indexdummyfont
  2011. \let\var=\indexdummyfont
  2012. \let\TeX=\indexdummytex
  2013. \let\dots=\indexdummydots
  2014. }
  2015.  
  2016. % To define \realbackslash, we must make \ not be an escape.
  2017. % We must first make another character (@) an escape
  2018. % so we do not become unable to do a definition.
  2019.  
  2020. {\catcode`\@=0 \catcode`\\=\other
  2021. @gdef@realbackslash{\}}
  2022.  
  2023. \let\indexbackslash=0  %overridden during \printindex.
  2024.  
  2025. \def\doind #1#2{%
  2026. {\count10=\lastpenalty %
  2027. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  2028. \escapechar=`\\%
  2029. {\let\folio=0% Expand all macros now EXCEPT \folio
  2030. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  2031. % so it will be output as is; and it will print as backslash in the indx.
  2032. %
  2033. % Now process the index-string once, with all font commands turned off,
  2034. % to get the string to sort the index by.
  2035. {\indexnofonts
  2036. \xdef\temp1{#2}%
  2037. }%
  2038. % Now produce the complete index entry.  We process the index-string again,
  2039. % this time with font commands expanded, to get what to print in the index.
  2040. \edef\temp{%
  2041. \write \csname#1indfile\endcsname{%
  2042. \realbackslash entry {\temp1}{\folio}{#2}}}%
  2043. \temp }%
  2044. }\penalty\count10}}
  2045.  
  2046. \def\dosubind #1#2#3{%
  2047. {\count10=\lastpenalty %
  2048. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  2049. \escapechar=`\\%
  2050. {\let\folio=0%
  2051. \def\rawbackslashxx{\indexbackslash}%
  2052. %
  2053. % Now process the index-string once, with all font commands turned off,
  2054. % to get the string to sort the index by.
  2055. {\indexnofonts
  2056. \xdef\temp1{#2 #3}%
  2057. }%
  2058. % Now produce the complete index entry.  We process the index-string again,
  2059. % this time with font commands expanded, to get what to print in the index.
  2060. \edef\temp{%
  2061. \write \csname#1indfile\endcsname{%
  2062. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  2063. \temp }%
  2064. }\penalty\count10}}
  2065.  
  2066. % The index entry written in the file actually looks like
  2067. %  \entry {sortstring}{page}{topic}
  2068. % or
  2069. %  \entry {sortstring}{page}{topic}{subtopic}
  2070. % The texindex program reads in these files and writes files
  2071. % containing these kinds of lines:
  2072. %  \initial {c}
  2073. %     before the first topic whose initial is c
  2074. %  \entry {topic}{pagelist}
  2075. %     for a topic that is used without subtopics
  2076. %  \primary {topic}
  2077. %     for the beginning of a topic that is used with subtopics
  2078. %  \secondary {subtopic}{pagelist}
  2079. %     for each subtopic.
  2080.  
  2081. % Define the user-accessible indexing commands
  2082. % @findex, @vindex, @kindex, @cindex.
  2083.  
  2084. \def\findex {\fnindex}
  2085. \def\kindex {\kyindex}
  2086. \def\cindex {\cpindex}
  2087. \def\vindex {\vrindex}
  2088. \def\tindex {\tpindex}
  2089. \def\pindex {\pgindex}
  2090.  
  2091. \def\cindexsub {\begingroup\obeylines\cindexsub}
  2092. {\obeylines %
  2093. \gdef\cindexsub "#1" #2^^M{\endgroup %
  2094. \dosubind{cp}{#2}{#1}}}
  2095.  
  2096. % Define the macros used in formatting output of the sorted index material.
  2097.  
  2098. % This is what you call to cause a particular index to get printed.
  2099. % Write
  2100. % @unnumbered Function Index
  2101. % @printindex fn
  2102.  
  2103. \def\printindex{\parsearg\doprintindex}
  2104.  
  2105. \def\doprintindex#1{%
  2106.   \tex
  2107.   \dobreak \chapheadingskip {10000}
  2108.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  2109.   \catcode`\$=\other
  2110.   \catcode`\~=\other
  2111.   \indexbreaks
  2112.   %
  2113.   % The following don't help, since the chars were translated
  2114.   % when the raw index was written, and their fonts were discarded
  2115.   % due to \indexnofonts.
  2116.   %\catcode`\"=\active
  2117.   %\catcode`\^=\active
  2118.   %\catcode`\_=\active
  2119.   %\catcode`\|=\active
  2120.   %\catcode`\<=\active
  2121.   %\catcode`\>=\active
  2122.   % %
  2123.   \def\indexbackslash{\rawbackslashxx}
  2124.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  2125.   \begindoublecolumns
  2126.   %
  2127.   % See if the index file exists and is nonempty.
  2128.   \openin 1 \jobname.#1s
  2129.   \ifeof 1
  2130.     % \enddoublecolumns gets confused if there is no text in the index,
  2131.     % and it loses the chapter title and the aux file entries for the
  2132.     % index.  The easiest way to prevent this problem is to make sure
  2133.     % there is some text.
  2134.     (Index is nonexistent)
  2135.     \else
  2136.     %
  2137.     % If the index file exists but is empty, then \openin leaves \ifeof
  2138.     % false.  We have to make TeX try to read something from the file, so
  2139.     % it can discover if there is anything in it.
  2140.     \read 1 to \temp
  2141.     \ifeof 1
  2142.       (Index is empty)
  2143.     \else
  2144.       \input \jobname.#1s
  2145.     \fi
  2146.   \fi
  2147.   \closein 1
  2148.   \enddoublecolumns
  2149.   \Etex
  2150. }
  2151.  
  2152. % These macros are used by the sorted index file itself.
  2153. % Change them to control the appearance of the index.
  2154.  
  2155. % Same as \bigskipamount except no shrink.
  2156. % \balancecolumns gets confused if there is any shrink.
  2157. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  2158.  
  2159. \def\initial #1{%
  2160. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  2161. \ifdim\lastskip<\initialskipamount
  2162. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  2163. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  2164.  
  2165. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  2166. % flush to the right margin.  It is used for index and table of contents
  2167. % entries.  The paragraph is indented by \leftskip.
  2168. %
  2169. \def\entry #1#2{\begingroup
  2170.   %
  2171.   % Start a new paragraph if necessary, so our assignments below can't
  2172.   % affect previous text.
  2173.   \par
  2174.   %
  2175.   % Do not fill out the last line with white space.
  2176.   \parfillskip = 0in
  2177.   %
  2178.   % No extra space above this paragraph.
  2179.   \parskip = 0in
  2180.   %
  2181.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  2182.   \finalhyphendemerits = 0
  2183.   %
  2184.   % \hangindent is only relevant when the entry text and page number
  2185.   % don't both fit on one line.  In that case, bob suggests starting the
  2186.   % dots pretty far over on the line.  Unfortunately, a large
  2187.   % indentation looks wrong when the entry text itself is broken across
  2188.   % lines.  So we use a small indentation and put up with long leaders.
  2189.   %
  2190.   % \hangafter is reset to 1 (which is the value we want) at the start
  2191.   % of each paragraph, so we need not do anything with that.
  2192.   \hangindent=2em
  2193.   %
  2194.   % When the entry text needs to be broken, just fill out the first line
  2195.   % with blank space.
  2196.   \rightskip = 0pt plus1fil
  2197.   %
  2198.   % Start a ``paragraph'' for the index entry so the line breaking
  2199.   % parameters we've set above will have an effect.
  2200.   \noindent
  2201.   %
  2202.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  2203.   #1%
  2204.   % The following is kluged to not output a line of dots in the index if
  2205.   % there are no page numbers.  The next person who breaks this will be
  2206.   % cursed by a Unix daemon.
  2207.   \def\tempa{{\rm }}%
  2208.   \def\tempb{#2}%
  2209.   \edef\tempc{\tempa}%
  2210.   \edef\tempd{\tempb}%
  2211.   \ifx\tempc\tempd\ \else%
  2212.     %
  2213.     % If we must, put the page number on a line of its own, and fill out
  2214.     % this line with blank space.  (The \hfil is overwhelmed with the
  2215.     % fill leaders glue in \indexdotfill if the page number does fit.)
  2216.     \hfil\penalty50
  2217.     \null\nobreak\indexdotfill % Have leaders before the page number.
  2218.     %
  2219.     % The `\ ' here is removed by the implicit \unskip that TeX does as
  2220.     % part of (the primitive) \par.  Without it, a spurious underfull
  2221.     % \hbox ensues.
  2222.     \ #2% The page number ends the paragraph.
  2223.   \fi%
  2224.   \par
  2225. \endgroup}
  2226.  
  2227. % Like \dotfill except takes at least 1 em.
  2228. \def\indexdotfill{\cleaders
  2229.   \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  2230.  
  2231. \def\primary #1{\line{#1\hfil}}
  2232.  
  2233. \newskip\secondaryindent \secondaryindent=0.5cm
  2234.  
  2235. \def\secondary #1#2{
  2236. {\parfillskip=0in \parskip=0in
  2237. \hangindent =1in \hangafter=1
  2238. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  2239. }}
  2240.  
  2241. %% Define two-column mode, which is used in indexes.
  2242. %% Adapted from the TeXbook, page 416.
  2243. \catcode `\@=11
  2244.  
  2245. \newbox\partialpage
  2246.  
  2247. \newdimen\doublecolumnhsize
  2248.  
  2249. \def\begindoublecolumns{\begingroup
  2250.   % Grab any single-column material above us.
  2251.   \output = {\global\setbox\partialpage
  2252.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  2253.   \eject
  2254.   %
  2255.   % Now switch to the double-column output routine.
  2256.   \output={\doublecolumnout}%
  2257.   %
  2258.   % Change the page size parameters.  We could do this once outside this
  2259.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  2260.   % format, but then we repeat the same computation.  Repeating a couple
  2261.   % of assignments once per index is clearly meaningless for the
  2262.   % execution time, so we may as well do it once.
  2263.   %
  2264.   % First we halve the line length, less a little for the gutter between
  2265.   % the columns.  We compute the gutter based on the line length, so it
  2266.   % changes automatically with the paper format.  The magic constant
  2267.   % below is chosen so that the gutter has the same value (well, +- <
  2268.   % 1pt) as it did when we hard-coded it.
  2269.   %
  2270.   % We put the result in a separate register, \doublecolumhsize, so we
  2271.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  2272.   % been clobbered.
  2273.   %
  2274.   \doublecolumnhsize = \hsize
  2275.     \advance\doublecolumnhsize by -.04154\hsize
  2276.     \divide\doublecolumnhsize by 2
  2277.   \hsize = \doublecolumnhsize
  2278.   %
  2279.   % Double the \vsize as well.  (We don't need a separate register here,
  2280.   % since nobody clobbers \vsize.)
  2281.   \vsize = 2\vsize
  2282.   \doublecolumnpagegoal
  2283. }
  2284.  
  2285. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  2286.  
  2287. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  2288.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  2289.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  2290.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  2291.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  2292.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  2293. }
  2294. \def\doublecolumnpagegoal{%
  2295.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  2296. }
  2297. \def\pagesofar{\unvbox\partialpage %
  2298.   \hsize=\doublecolumnhsize % have to restore this since output routine
  2299.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  2300. \def\doublecolumnout{%
  2301.   \setbox5=\copy255
  2302.   {\vbadness=10000 \doublecolumnsplit}
  2303.   \ifvbox255
  2304.     \setbox0=\vtop to\dimen@{\unvbox0}
  2305.     \setbox2=\vtop to\dimen@{\unvbox2}
  2306.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  2307.   \else
  2308.     \setbox0=\vbox{\unvbox5}
  2309.     \ifvbox0
  2310.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  2311.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  2312.       {\vbadness=10000
  2313.     \loop \global\setbox5=\copy0
  2314.           \setbox1=\vsplit5 to\dimen@
  2315.           \setbox3=\vsplit5 to\dimen@
  2316.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  2317.         \setbox0=\vbox to\dimen@{\unvbox1}
  2318.         \setbox2=\vbox to\dimen@{\unvbox3}
  2319.         \global\setbox\partialpage=\vbox{\pagesofar}
  2320.         \doublecolumnpagegoal
  2321.       }
  2322.     \fi
  2323.   \fi
  2324. }
  2325.  
  2326. \catcode `\@=\other
  2327. \message{sectioning,}
  2328. % Define chapters, sections, etc.
  2329.  
  2330. \newcount \chapno
  2331. \newcount \secno        \secno=0
  2332. \newcount \subsecno     \subsecno=0
  2333. \newcount \subsubsecno  \subsubsecno=0
  2334.  
  2335. % This counter is funny since it counts through charcodes of letters A, B, ...
  2336. \newcount \appendixno  \appendixno = `\@
  2337. \def\appendixletter{\char\the\appendixno}
  2338.  
  2339. \newwrite \contentsfile
  2340. % This is called from \setfilename.
  2341. \def\opencontents{\openout \contentsfile = \jobname.toc}
  2342.  
  2343. % Each @chapter defines this as the name of the chapter.
  2344. % page headings and footings can use it.  @section does likewise
  2345.  
  2346. \def\thischapter{} \def\thissection{}
  2347. \def\seccheck#1{\if \pageno<0 %
  2348. \errmessage{@#1 not allowed after generating table of contents}\fi
  2349. %
  2350. }
  2351.  
  2352. \def\chapternofonts{%
  2353. \let\rawbackslash=\relax%
  2354. \let\frenchspacing=\relax%
  2355. \def\result{\realbackslash result}
  2356. \def\equiv{\realbackslash equiv}
  2357. \def\expansion{\realbackslash expansion}
  2358. \def\print{\realbackslash print}
  2359. \def\TeX{\realbackslash TeX}
  2360. \def\dots{\realbackslash dots}
  2361. \def\copyright{\realbackslash copyright}
  2362. \def\tt{\realbackslash tt}
  2363. \def\bf{\realbackslash bf }
  2364. \def\w{\realbackslash w}
  2365. \def\less{\realbackslash less}
  2366. \def\gtr{\realbackslash gtr}
  2367. \def\hat{\realbackslash hat}
  2368. \def\char{\realbackslash char}
  2369. \def\tclose##1{\realbackslash tclose {##1}}
  2370. \def\code##1{\realbackslash code {##1}}
  2371. \def\samp##1{\realbackslash samp {##1}}
  2372. \def\r##1{\realbackslash r {##1}}
  2373. \def\b##1{\realbackslash b {##1}}
  2374. \def\key##1{\realbackslash key {##1}}
  2375. \def\file##1{\realbackslash file {##1}}
  2376. \def\kbd##1{\realbackslash kbd {##1}}
  2377. % These are redefined because @smartitalic wouldn't work inside xdef.
  2378. \def\i##1{\realbackslash i {##1}}
  2379. \def\cite##1{\realbackslash cite {##1}}
  2380. \def\var##1{\realbackslash var {##1}}
  2381. \def\emph##1{\realbackslash emph {##1}}
  2382. \def\dfn##1{\realbackslash dfn {##1}}
  2383. }
  2384.  
  2385. \newcount\absseclevel % used to calculate proper heading level
  2386. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  2387.  
  2388. % @raisesections: treat @section as chapter, @subsection as section, etc.
  2389. \def\raisesections{\global\advance\secbase by -1}
  2390. \let\up=\raisesections % original BFox name
  2391.  
  2392. % @lowersections: treat @chapter as section, @section as subsection, etc.
  2393. \def\lowersections{\global\advance\secbase by 1}
  2394. \let\down=\lowersections % original BFox name
  2395.  
  2396. % Choose a numbered-heading macro
  2397. % #1 is heading level if unmodified by @raisesections or @lowersections
  2398. % #2 is text for heading
  2399. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2400. \ifcase\absseclevel
  2401.   \chapterzzz{#2}
  2402. \or
  2403.   \seczzz{#2}
  2404. \or
  2405.   \numberedsubseczzz{#2}
  2406. \or
  2407.   \numberedsubsubseczzz{#2}
  2408. \else
  2409.   \ifnum \absseclevel<0
  2410.     \chapterzzz{#2}
  2411.   \else
  2412.     \numberedsubsubseczzz{#2}
  2413.   \fi
  2414. \fi
  2415. }
  2416.  
  2417. % like \numhead, but chooses appendix heading levels
  2418. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2419. \ifcase\absseclevel
  2420.   \appendixzzz{#2}
  2421. \or
  2422.   \appendixsectionzzz{#2}
  2423. \or
  2424.   \appendixsubseczzz{#2}
  2425. \or
  2426.   \appendixsubsubseczzz{#2}
  2427. \else
  2428.   \ifnum \absseclevel<0
  2429.     \appendixzzz{#2}
  2430.   \else
  2431.     \appendixsubsubseczzz{#2}
  2432.   \fi
  2433. \fi
  2434. }
  2435.  
  2436. % like \numhead, but chooses numberless heading levels
  2437. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  2438. \ifcase\absseclevel
  2439.   \unnumberedzzz{#2}
  2440. \or
  2441.   \unnumberedseczzz{#2}
  2442. \or
  2443.   \unnumberedsubseczzz{#2}
  2444. \or
  2445.   \unnumberedsubsubseczzz{#2}
  2446. \else
  2447.   \ifnum \absseclevel<0
  2448.     \unnumberedzzz{#2}
  2449.   \else
  2450.     \unnumberedsubsubseczzz{#2}
  2451.   \fi
  2452. \fi
  2453. }
  2454.  
  2455.  
  2456. \def\thischaptername{No Chapter Title}
  2457. \outer\def\chapter{\parsearg\chapteryyy}
  2458. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  2459. \def\chapterzzz #1{\seccheck{chapter}%
  2460. \secno=0 \subsecno=0 \subsubsecno=0
  2461. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  2462. \chapmacro {#1}{\the\chapno}%
  2463. \gdef\thissection{#1}%
  2464. \gdef\thischaptername{#1}%
  2465. % We don't substitute the actual chapter name into \thischapter
  2466. % because we don't want its macros evaluated now.
  2467. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  2468. {\chapternofonts%
  2469. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  2470. \escapechar=`\\%
  2471. \write \contentsfile \temp  %
  2472. \donoderef %
  2473. \global\let\section = \numberedsec
  2474. \global\let\subsection = \numberedsubsec
  2475. \global\let\subsubsection = \numberedsubsubsec
  2476. }}
  2477.  
  2478. \outer\def\appendix{\parsearg\appendixyyy}
  2479. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  2480. \def\appendixzzz #1{\seccheck{appendix}%
  2481. \secno=0 \subsecno=0 \subsubsecno=0
  2482. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  2483. \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
  2484. \gdef\thissection{#1}%
  2485. \gdef\thischaptername{#1}%
  2486. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  2487. {\chapternofonts%
  2488. \edef\temp{{\realbackslash chapentry
  2489.   {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
  2490. \escapechar=`\\%
  2491. \write \contentsfile \temp  %
  2492. \appendixnoderef %
  2493. \global\let\section = \appendixsec
  2494. \global\let\subsection = \appendixsubsec
  2495. \global\let\subsubsection = \appendixsubsubsec
  2496. }}
  2497.  
  2498. \outer\def\top{\parsearg\unnumberedyyy}
  2499. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  2500. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  2501. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  2502. \secno=0 \subsecno=0 \subsubsecno=0
  2503. %
  2504. % This used to be simply \message{#1}, but TeX fully expands the
  2505. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  2506. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  2507. % expanded @cite (which turns out to cause errors because \cite is meant
  2508. % to be executed, not expanded).
  2509. %
  2510. % Anyway, we don't want the fully-expanded definition of @cite to appear
  2511. % as a result of the \message, we just want `@cite' itself.  We use
  2512. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  2513. % simply yielding the contents of the <toks register>.
  2514. \toks0 = {#1}\message{(\the\toks0)}%
  2515. %
  2516. \unnumbchapmacro {#1}%
  2517. \gdef\thischapter{#1}\gdef\thissection{#1}%
  2518. {\chapternofonts%
  2519. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  2520. \escapechar=`\\%
  2521. \write \contentsfile \temp  %
  2522. \unnumbnoderef %
  2523. \global\let\section = \unnumberedsec
  2524. \global\let\subsection = \unnumberedsubsec
  2525. \global\let\subsubsection = \unnumberedsubsubsec
  2526. }}
  2527.  
  2528. \outer\def\numberedsec{\parsearg\secyyy}
  2529. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  2530. \def\seczzz #1{\seccheck{section}%
  2531. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2532. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  2533. {\chapternofonts%
  2534. \edef\temp{{\realbackslash secentry %
  2535. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  2536. \escapechar=`\\%
  2537. \write \contentsfile \temp %
  2538. \donoderef %
  2539. \penalty 10000 %
  2540. }}
  2541.  
  2542. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  2543. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  2544. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  2545. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  2546. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  2547. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  2548. {\chapternofonts%
  2549. \edef\temp{{\realbackslash secentry %
  2550. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  2551. \escapechar=`\\%
  2552. \write \contentsfile \temp %
  2553. \appendixnoderef %
  2554. \penalty 10000 %
  2555. }}
  2556.  
  2557. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  2558. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  2559. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  2560. \plainsecheading {#1}\gdef\thissection{#1}%
  2561. {\chapternofonts%
  2562. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  2563. \escapechar=`\\%
  2564. \write \contentsfile \temp %
  2565. \unnumbnoderef %
  2566. \penalty 10000 %
  2567. }}
  2568.  
  2569. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  2570. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  2571. \def\numberedsubseczzz #1{\seccheck{subsection}%
  2572. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2573. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  2574. {\chapternofonts%
  2575. \edef\temp{{\realbackslash subsecentry %
  2576. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  2577. \escapechar=`\\%
  2578. \write \contentsfile \temp %
  2579. \donoderef %
  2580. \penalty 10000 %
  2581. }}
  2582.  
  2583. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  2584. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  2585. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  2586. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  2587. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  2588. {\chapternofonts%
  2589. \edef\temp{{\realbackslash subsecentry %
  2590. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  2591. \escapechar=`\\%
  2592. \write \contentsfile \temp %
  2593. \appendixnoderef %
  2594. \penalty 10000 %
  2595. }}
  2596.  
  2597. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  2598. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  2599. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  2600. \plainsecheading {#1}\gdef\thissection{#1}%
  2601. {\chapternofonts%
  2602. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  2603. \escapechar=`\\%
  2604. \write \contentsfile \temp %
  2605. \unnumbnoderef %
  2606. \penalty 10000 %
  2607. }}
  2608.  
  2609. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  2610. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  2611. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  2612. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2613. \subsubsecheading {#1}
  2614.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2615. {\chapternofonts%
  2616. \edef\temp{{\realbackslash subsubsecentry %
  2617.   {#1}
  2618.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  2619.   {\noexpand\folio}}}%
  2620. \escapechar=`\\%
  2621. \write \contentsfile \temp %
  2622. \donoderef %
  2623. \penalty 10000 %
  2624. }}
  2625.  
  2626. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  2627. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  2628. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  2629. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  2630. \subsubsecheading {#1}
  2631.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  2632. {\chapternofonts%
  2633. \edef\temp{{\realbackslash subsubsecentry{#1}%
  2634.   {\appendixletter}
  2635.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  2636. \escapechar=`\\%
  2637. \write \contentsfile \temp %
  2638. \appendixnoderef %
  2639. \penalty 10000 %
  2640. }}
  2641.  
  2642. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  2643. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  2644. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  2645. \plainsecheading {#1}\gdef\thissection{#1}%
  2646. {\chapternofonts%
  2647. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  2648. \escapechar=`\\%
  2649. \write \contentsfile \temp %
  2650. \unnumbnoderef %
  2651. \penalty 10000 %
  2652. }}
  2653.  
  2654. % These are variants which are not "outer", so they can appear in @ifinfo.
  2655. % Actually, they should now be obsolete; ordinary section commands should work.
  2656. \def\infotop{\parsearg\unnumberedzzz}
  2657. \def\infounnumbered{\parsearg\unnumberedzzz}
  2658. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  2659. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  2660. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  2661.  
  2662. \def\infoappendix{\parsearg\appendixzzz}
  2663. \def\infoappendixsec{\parsearg\appendixseczzz}
  2664. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  2665. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  2666.  
  2667. \def\infochapter{\parsearg\chapterzzz}
  2668. \def\infosection{\parsearg\sectionzzz}
  2669. \def\infosubsection{\parsearg\subsectionzzz}
  2670. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  2671.  
  2672. % These macros control what the section commands do, according
  2673. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  2674. % Define them by default for a numbered chapter.
  2675. \global\let\section = \numberedsec
  2676. \global\let\subsection = \numberedsubsec
  2677. \global\let\subsubsection = \numberedsubsubsec
  2678.  
  2679. % Define @majorheading, @heading and @subheading
  2680.  
  2681. % NOTE on use of \vbox for chapter headings, section headings, and
  2682. % such:
  2683. %    1) We use \vbox rather than the earlier \line to permit
  2684. %       overlong headings to fold.
  2685. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  2686. %       heading is obnoxious; this forbids it.
  2687. %       3) Likewise, headings look best if no \parindent is used, and
  2688. %          if justification is not attempted.  Hence \raggedright.
  2689.  
  2690.  
  2691. \def\majorheading{\parsearg\majorheadingzzz}
  2692. \def\majorheadingzzz #1{%
  2693. {\advance\chapheadingskip by 10pt \chapbreak }%
  2694. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2695.                   \parindent=0pt\raggedright
  2696.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2697.  
  2698. \def\chapheading{\parsearg\chapheadingzzz}
  2699. \def\chapheadingzzz #1{\chapbreak %
  2700. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2701.                   \parindent=0pt\raggedright
  2702.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2703.  
  2704. \def\heading{\parsearg\secheadingi}
  2705.  
  2706. \def\subheading{\parsearg\subsecheadingi}
  2707.  
  2708. \def\subsubheading{\parsearg\subsubsecheadingi}
  2709.  
  2710. % These macros generate a chapter, section, etc. heading only
  2711. % (including whitespace, linebreaking, etc. around it),
  2712. % given all the information in convenient, parsed form.
  2713.  
  2714. %%% Args are the skip and penalty (usually negative)
  2715. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  2716.  
  2717. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  2718.  
  2719. %%% Define plain chapter starts, and page on/off switching for it
  2720. % Parameter controlling skip before chapter headings (if needed)
  2721.  
  2722. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  2723.  
  2724. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  2725. \def\chappager{\par\vfill\supereject}
  2726. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  2727.  
  2728. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  2729.  
  2730. \def\CHAPPAGoff{
  2731. \global\let\pchapsepmacro=\chapbreak
  2732. \global\let\pagealignmacro=\chappager}
  2733.  
  2734. \def\CHAPPAGon{
  2735. \global\let\pchapsepmacro=\chappager
  2736. \global\let\pagealignmacro=\chappager
  2737. \global\def\HEADINGSon{\HEADINGSsingle}}
  2738.  
  2739. \def\CHAPPAGodd{
  2740. \global\let\pchapsepmacro=\chapoddpage
  2741. \global\let\pagealignmacro=\chapoddpage
  2742. \global\def\HEADINGSon{\HEADINGSdouble}}
  2743.  
  2744. \CHAPPAGon
  2745.  
  2746. \def\CHAPFplain{
  2747. \global\let\chapmacro=\chfplain
  2748. \global\let\unnumbchapmacro=\unnchfplain}
  2749.  
  2750. \def\chfplain #1#2{%
  2751.   \pchapsepmacro
  2752.   {%
  2753.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2754.                      \parindent=0pt\raggedright
  2755.                      \rm #2\enspace #1}%
  2756.   }%
  2757.   \bigskip
  2758.   \penalty5000
  2759. }
  2760.  
  2761. \def\unnchfplain #1{%
  2762. \pchapsepmacro %
  2763. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2764.                   \parindent=0pt\raggedright
  2765.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2766. }
  2767. \CHAPFplain % The default
  2768.  
  2769. \def\unnchfopen #1{%
  2770. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2771.                        \parindent=0pt\raggedright
  2772.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2773. }
  2774.  
  2775. \def\chfopen #1#2{\chapoddpage {\chapfonts
  2776. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  2777. \par\penalty 5000 %
  2778. }
  2779.  
  2780. \def\CHAPFopen{
  2781. \global\let\chapmacro=\chfopen
  2782. \global\let\unnumbchapmacro=\unnchfopen}
  2783.  
  2784. % Parameter controlling skip before section headings.
  2785.  
  2786. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  2787. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  2788.  
  2789. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  2790. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2791.  
  2792. % @paragraphindent  is defined for the Info formatting commands only.
  2793. \let\paragraphindent=\comment
  2794.  
  2795. % Section fonts are the base font at magstep2, which produces
  2796. % a size a bit more than 14 points in the default situation.
  2797.  
  2798. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  2799. \def\plainsecheading #1{\secheadingi {#1}}
  2800. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  2801. \secheadingbreak}%
  2802. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2803.                  \parindent=0pt\raggedright
  2804.                  \rm #1\hfill}}%
  2805. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2806.  
  2807.  
  2808. % Subsection fonts are the base font at magstep1,
  2809. % which produces a size of 12 points.
  2810.  
  2811. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  2812. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2813. \subsecheadingbreak}%
  2814. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2815.                      \parindent=0pt\raggedright
  2816.                      \rm #1\hfill}}%
  2817. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2818.  
  2819. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  2820.                   % Perhaps make sssec fonts scaled
  2821.                   % magstep half
  2822. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  2823. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2824. \subsecheadingbreak}%
  2825. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2826.                        \parindent=0pt\raggedright
  2827.                        \rm #1\hfill}}%
  2828. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  2829.  
  2830.  
  2831. \message{toc printing,}
  2832.  
  2833. % Finish up the main text and prepare to read what we've written
  2834. % to \contentsfile.
  2835.  
  2836. \newskip\contentsrightmargin \contentsrightmargin=1in
  2837. \def\startcontents#1{%
  2838.    \pagealignmacro
  2839.    \immediate\closeout \contentsfile
  2840.    \ifnum \pageno>0
  2841.       \pageno = -1        % Request roman numbered pages.
  2842.    \fi
  2843.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2844.    % It is abundantly clear what they are.
  2845.    \unnumbchapmacro{#1}\def\thischapter{}%
  2846.    \begingroup           % Set up to handle contents files properly.
  2847.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2848.       \catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi
  2849.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2850.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2851. }
  2852.  
  2853.  
  2854. % Normal (long) toc.
  2855. \outer\def\contents{%
  2856.    \startcontents{\putwordTableofContents}%
  2857.       \input \jobname.toc
  2858.    \endgroup
  2859.    \vfill \eject
  2860. }
  2861.  
  2862. % And just the chapters.
  2863. \outer\def\summarycontents{%
  2864.    \startcontents{\putwordShortContents}%
  2865.       %
  2866.       \let\chapentry = \shortchapentry
  2867.       \let\unnumbchapentry = \shortunnumberedentry
  2868.       % We want a true roman here for the page numbers.
  2869.       \secfonts
  2870.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2871.       \rm
  2872.       \advance\baselineskip by 1pt % Open it up a little.
  2873.       \def\secentry ##1##2##3##4{}
  2874.       \def\unnumbsecentry ##1##2{}
  2875.       \def\subsecentry ##1##2##3##4##5{}
  2876.       \def\unnumbsubsecentry ##1##2{}
  2877.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2878.       \def\unnumbsubsubsecentry ##1##2{}
  2879.       \input \jobname.toc
  2880.    \endgroup
  2881.    \vfill \eject
  2882. }
  2883. \let\shortcontents = \summarycontents
  2884.  
  2885. % These macros generate individual entries in the table of contents.
  2886. % The first argument is the chapter or section name.
  2887. % The last argument is the page number.
  2888. % The arguments in between are the chapter number, section number, ...
  2889.  
  2890. % Chapter-level things, for both the long and short contents.
  2891. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2892.  
  2893. % See comments in \dochapentry re vbox and related settings
  2894. \def\shortchapentry#1#2#3{%
  2895.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2896. }
  2897.  
  2898. % Typeset the label for a chapter or appendix for the short contents.
  2899. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2900. % We could simplify the code here by writing out an \appendixentry
  2901. % command in the toc file for appendices, instead of using \chapentry
  2902. % for both, but it doesn't seem worth it.
  2903. \setbox0 = \hbox{\shortcontrm \putwordAppendix }
  2904. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2905.  
  2906. \def\shortchaplabel#1{%
  2907.   % We typeset #1 in a box of constant width, regardless of the text of
  2908.   % #1, so the chapter titles will come out aligned.
  2909.   \setbox0 = \hbox{#1}%
  2910.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2911.   %
  2912.   % This space should be plenty, since a single number is .5em, and the
  2913.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2914.   % (This space doesn't include the extra space that gets added after
  2915.   % the label; that gets put in in \shortchapentry above.)
  2916.   \advance\dimen0 by 1.1em
  2917.   \hbox to \dimen0{#1\hfil}%
  2918. }
  2919.  
  2920. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2921. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2922.  
  2923. % Sections.
  2924. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2925. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2926.  
  2927. % Subsections.
  2928. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2929. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2930.  
  2931. % And subsubsections.
  2932. \def\subsubsecentry#1#2#3#4#5#6{%
  2933.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2934. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2935.  
  2936.  
  2937. % This parameter controls the indentation of the various levels.
  2938. \newdimen\tocindent \tocindent = 3pc
  2939.  
  2940. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2941. % page number.
  2942. %
  2943. % If the toc has to be broken over pages, we would want to be at chapters
  2944. % if at all possible; hence the \penalty.
  2945. \def\dochapentry#1#2{%
  2946.    \penalty-300 \vskip\baselineskip
  2947.    \begingroup
  2948.      \chapentryfonts
  2949.      \tocentry{#1}{\dopageno{#2}}%
  2950.    \endgroup
  2951.    \nobreak\vskip .25\baselineskip
  2952. }
  2953.  
  2954. \def\dosecentry#1#2{\begingroup
  2955.   \secentryfonts \leftskip=\tocindent
  2956.   \tocentry{#1}{\dopageno{#2}}%
  2957. \endgroup}
  2958.  
  2959. \def\dosubsecentry#1#2{\begingroup
  2960.   \subsecentryfonts \leftskip=2\tocindent
  2961.   \tocentry{#1}{\dopageno{#2}}%
  2962. \endgroup}
  2963.  
  2964. \def\dosubsubsecentry#1#2{\begingroup
  2965.   \subsubsecentryfonts \leftskip=3\tocindent
  2966.   \tocentry{#1}{\dopageno{#2}}%
  2967. \endgroup}
  2968.  
  2969. % Final typesetting of a toc entry; we use the same \entry macro as for
  2970. % the index entries, but we want to suppress hyphenation here.  (We
  2971. % can't do that in the \entry macro, since index entries might consist
  2972. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2973. %
  2974. \def\tocentry#1#2{\begingroup
  2975.   \hyphenpenalty = 10000
  2976.   \entry{#1}{#2}%
  2977. \endgroup}
  2978.  
  2979. % Space between chapter (or whatever) number and the title.
  2980. \def\labelspace{\hskip1em \relax}
  2981.  
  2982. \def\dopageno#1{{\rm #1}}
  2983. \def\doshortpageno#1{{\rm #1}}
  2984.  
  2985. \def\chapentryfonts{\secfonts \rm}
  2986. \def\secentryfonts{\textfonts}
  2987. \let\subsecentryfonts = \textfonts
  2988. \let\subsubsecentryfonts = \textfonts
  2989.  
  2990.  
  2991. \message{environments,}
  2992.  
  2993. % Since these characters are used in examples, it should be an even number of
  2994. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2995. % Furthermore, these definitions must come after we define our fonts.
  2996. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2997. \newbox\pushcharbox    \newbox\bullbox
  2998. \newbox\equivbox       \newbox\errorbox
  2999.  
  3000. \let\ptexequiv = \equiv
  3001.  
  3002. %{\tentt
  3003. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  3004. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  3005. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  3006. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  3007. % Adapted from the manmac format (p.420 of TeXbook)
  3008. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  3009. %                                      depth .1ex\hfil}
  3010. %}
  3011.  
  3012. \def\point{$\star$}
  3013.  
  3014. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  3015. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  3016. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  3017.  
  3018. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  3019.  
  3020. % Adapted from the TeXbook's \boxit.
  3021. {\tentt \global\dimen0 = 3em}% Width of the box.
  3022. \dimen2 = .55pt % Thickness of rules
  3023. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  3024. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  3025.  
  3026. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  3027.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  3028.    \advance\hsize by -2\dimen2 % Rules.
  3029.    \vbox{
  3030.       \hrule height\dimen2
  3031.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  3032.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  3033.          \kern3pt\vrule width\dimen2}% Space to right.
  3034.       \hrule height\dimen2}
  3035.     \hfil}
  3036.  
  3037. % The @error{} command.
  3038. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  3039.  
  3040. % @tex ... @end tex    escapes into raw Tex temporarily.
  3041. % One exception: @ is still an escape character, so that @end tex works.
  3042. % But \@ or @@ will get a plain tex @ character.
  3043.  
  3044. \def\tex{\begingroup
  3045. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  3046. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  3047. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  3048. \catcode `\%=14
  3049. \catcode 43=12
  3050. \catcode`\"=12
  3051. \catcode`\==12
  3052. \catcode`\|=12
  3053. \catcode`\<=12
  3054. \catcode`\>=12
  3055. \escapechar=`\\
  3056. %
  3057. \let\~=\ptextilde
  3058. \let\{=\ptexlbrace
  3059. \let\}=\ptexrbrace
  3060. \let\.=\ptexdot
  3061. \let\*=\ptexstar
  3062. \let\dots=\ptexdots
  3063. \def\@{@}%
  3064. \let\bullet=\ptexbullet
  3065. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  3066. \let\L=\ptexL
  3067. %
  3068. \let\Etex=\endgroup}
  3069.  
  3070. % Define @lisp ... @endlisp.
  3071. % @lisp does a \begingroup so it can rebind things,
  3072. % including the definition of @endlisp (which normally is erroneous).
  3073.  
  3074. % Amount to narrow the margins by for @lisp.
  3075. \newskip\lispnarrowing \lispnarrowing=0.4in
  3076.  
  3077. % This is the definition that ^^M gets inside @lisp, @example, and other
  3078. % such environments.  \null is better than a space, since it doesn't
  3079. % have any width.
  3080. \def\lisppar{\null\endgraf}
  3081.  
  3082. % Make each space character in the input produce a normal interword
  3083. % space in the output.  Don't allow a line break at this space, as this
  3084. % is used only in environments like @example, where each line of input
  3085. % should produce a line of output anyway.
  3086. %
  3087. {\obeyspaces %
  3088. \gdef\sepspaces{\obeyspaces\let =\tie}}
  3089.  
  3090. % Define \obeyedspace to be our active space, whatever it is.  This is
  3091. % for use in \parsearg.
  3092. {\sepspaces%
  3093. \global\let\obeyedspace= }
  3094.  
  3095. % This space is always present above and below environments.
  3096. \newskip\envskipamount \envskipamount = 0pt
  3097.  
  3098. % Make spacing and below environment symmetrical.  We use \parskip here
  3099. % to help in doing that, since in @example-like environments \parskip
  3100. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  3101. % start of the next paragraph will insert \parskip
  3102. %
  3103. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  3104. \endgraf \ifdim\lastskip<\envskipamount
  3105. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  3106.  
  3107. \let\afterenvbreak = \aboveenvbreak
  3108.  
  3109. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  3110. \let\nonarrowing=\relax
  3111.  
  3112. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3113. % \cartouche: draw rectangle w/rounded corners around argument
  3114. \font\circle=lcircle10
  3115. \newdimen\circthick
  3116. \newdimen\cartouter\newdimen\cartinner
  3117. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  3118. \circthick=\fontdimen8\circle
  3119. %
  3120. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  3121. \def\ctr{{\hskip 6pt\circle\char'010}}
  3122. \def\cbl{{\circle\char'012\hskip -6pt}}
  3123. \def\cbr{{\hskip 6pt\circle\char'011}}
  3124. \def\carttop{\hbox to \cartouter{\hskip\lskip
  3125.     \ctl\leaders\hrule height\circthick\hfil\ctr
  3126.     \hskip\rskip}}
  3127. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  3128.     \cbl\leaders\hrule height\circthick\hfil\cbr
  3129.     \hskip\rskip}}
  3130. %
  3131. \newskip\lskip\newskip\rskip
  3132.  
  3133. \long\def\cartouche{%
  3134. \begingroup
  3135.     \lskip=\leftskip \rskip=\rightskip
  3136.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  3137.     \cartinner=\hsize \advance\cartinner by-\lskip
  3138.                \advance\cartinner by-\rskip
  3139.     \cartouter=\hsize
  3140.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  3141. %                     side, and for 6pt waste from
  3142. %                     each corner char
  3143.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  3144.     % Flag to tell @lisp, etc., not to narrow margin.
  3145.     \let\nonarrowing=\comment
  3146.     \vbox\bgroup
  3147.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  3148.         \carttop
  3149.         \hbox\bgroup
  3150.             \hskip\lskip
  3151.             \vrule\kern3pt
  3152.             \vbox\bgroup
  3153.                 \hsize=\cartinner
  3154.                 \kern3pt
  3155.                 \begingroup
  3156.                     \baselineskip=\normbskip
  3157.                     \lineskip=\normlskip
  3158.                     \parskip=\normpskip
  3159.                     \vskip -\parskip
  3160. \def\Ecartouche{%
  3161.                 \endgroup
  3162.                 \kern3pt
  3163.             \egroup
  3164.             \kern3pt\vrule
  3165.             \hskip\rskip
  3166.         \egroup
  3167.         \cartbot
  3168.     \egroup
  3169. \endgroup
  3170. }}
  3171.  
  3172.  
  3173. % This macro is called at the beginning of all the @example variants,
  3174. % inside a group.
  3175. \def\nonfillstart{%
  3176.   \aboveenvbreak
  3177.   \inENV % This group ends at the end of the body
  3178.   \hfuzz = 12pt % Don't be fussy
  3179.   \sepspaces % Make spaces be word-separators rather than space tokens.
  3180.   \singlespace
  3181.   \let\par = \lisppar % don't ignore blank lines
  3182.   \obeylines % each line of input is a line of output
  3183.   \parskip = 0pt
  3184.   \parindent = 0pt
  3185.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  3186.   % @cartouche defines \nonarrowing to inhibit narrowing
  3187.   % at next level down.
  3188.   \ifx\nonarrowing\relax
  3189.     \advance \leftskip by \lispnarrowing
  3190.     \exdentamount=\lispnarrowing
  3191.     \let\exdent=\nofillexdent
  3192.     \let\nonarrowing=\relax
  3193.   \fi
  3194. }
  3195.  
  3196. % To ending an @example-like environment, we first end the paragraph
  3197. % (via \afterenvbreak's vertical glue), and then the group.  That way we
  3198. % keep the zero \parskip that the environments set -- \parskip glue
  3199. % will be inserted at the beginning of the next paragraph in the
  3200. % document, after the environment.
  3201. %
  3202. \def\nonfillfinish{\afterenvbreak\endgroup}%
  3203.  
  3204. % This macro is
  3205. \def\lisp{\begingroup
  3206.   \nonfillstart
  3207.   \let\Elisp = \nonfillfinish
  3208.   \tt
  3209.   \rawbackslash % have \ input char produce \ char from current font
  3210.   \gobble
  3211. }
  3212.  
  3213. % Define the \E... control sequence only if we are inside the
  3214. % environment, so the error checking in \end will work.
  3215. %
  3216. % We must call \lisp last in the definition, since it reads the
  3217. % return following the @example (or whatever) command.
  3218. %
  3219. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  3220. \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  3221. \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  3222.  
  3223. % @smallexample and @smalllisp.  This is not used unless the @smallbook
  3224. % command is given.  Originally contributed by Pavel@xerox.
  3225. %
  3226. \def\smalllispx{\begingroup
  3227.   \nonfillstart
  3228.   \let\Esmalllisp = \nonfillfinish
  3229.   \let\Esmallexample = \nonfillfinish
  3230.   %
  3231.   % Smaller interline space and fonts for small examples.
  3232.   \setleading{10pt}%
  3233.   \indexfonts \tt
  3234.   \rawbackslash % make \ output the \ character from the current font (tt)
  3235.   \gobble
  3236. }
  3237.  
  3238. % This is @display; same as @lisp except use roman font.
  3239. %
  3240. \def\display{\begingroup
  3241.   \nonfillstart
  3242.   \let\Edisplay = \nonfillfinish
  3243.   \gobble
  3244. }
  3245.  
  3246. % This is @format; same as @display except don't narrow margins.
  3247. %
  3248. \def\format{\begingroup
  3249.   \let\nonarrowing = t
  3250.   \nonfillstart
  3251.   \let\Eformat = \nonfillfinish
  3252.   \gobble
  3253. }
  3254.  
  3255. % @flushleft (same as @format) and @flushright.
  3256. %
  3257. \def\flushleft{\begingroup
  3258.   \let\nonarrowing = t
  3259.   \nonfillstart
  3260.   \let\Eflushleft = \nonfillfinish
  3261.   \gobble
  3262. }
  3263. \def\flushright{\begingroup
  3264.   \let\nonarrowing = t
  3265.   \nonfillstart
  3266.   \let\Eflushright = \nonfillfinish
  3267.   \advance\leftskip by 0pt plus 1fill
  3268.   \gobble}
  3269.  
  3270. % @quotation does normal linebreaking (hence we can't use \nonfillstart)
  3271. % and narrows the margins.
  3272. %
  3273. \def\quotation{%
  3274.   \begingroup\inENV %This group ends at the end of the @quotation body
  3275.   {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip
  3276.   \singlespace
  3277.   \parindent=0pt
  3278.   % We have retained a nonzero parskip for the environment, since we're
  3279.   % doing normal filling. So to avoid extra space below the environment...
  3280.   \def\Equotation{\parskip = 0pt \nonfillfinish}%
  3281.   %
  3282.   % @cartouche defines \nonarrowing to inhibit narrowing at next level down.
  3283.   \ifx\nonarrowing\relax
  3284.     \advance\leftskip by \lispnarrowing
  3285.     \advance\rightskip by \lispnarrowing
  3286.     \exdentamount = \lispnarrowing
  3287.     \let\nonarrowing = \relax
  3288.   \fi
  3289. }
  3290.  
  3291. \message{defuns,}
  3292. % Define formatter for defuns
  3293. % First, allow user to change definition object font (\df) internally
  3294. \def\setdeffont #1 {\csname DEF#1\endcsname}
  3295.  
  3296. \newskip\defbodyindent \defbodyindent=.4in
  3297. \newskip\defargsindent \defargsindent=50pt
  3298. \newskip\deftypemargin \deftypemargin=12pt
  3299. \newskip\deflastargmargin \deflastargmargin=18pt
  3300.  
  3301. \newcount\parencount
  3302. % define \functionparens, which makes ( and ) and & do special things.
  3303. % \functionparens affects the group it is contained in.
  3304. \def\activeparens{%
  3305. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  3306. \catcode`\[=\active \catcode`\]=\active}
  3307.  
  3308. % Make control sequences which act like normal parenthesis chars.
  3309. \let\lparen = ( \let\rparen = )
  3310.  
  3311. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  3312.  
  3313. % Be sure that we always have a definition for `(', etc.  For example,
  3314. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  3315. % so TeX would otherwise complain about undefined control sequence.
  3316. \global\let(=\lparen \global\let)=\rparen
  3317. \global\let[=\lbrack \global\let]=\rbrack
  3318.  
  3319. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  3320. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  3321.  
  3322. % Definitions of (, ) and & used in args for functions.
  3323. % This is the definition of ( outside of all parentheses.
  3324. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  3325. \global\advance\parencount by 1 }
  3326. %
  3327. % This is the definition of ( when already inside a level of parens.
  3328. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  3329. %
  3330. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  3331. % also in that case restore the outer-level definition of (.
  3332. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  3333. \global\advance \parencount by -1 }
  3334. % If we encounter &foo, then turn on ()-hacking afterwards
  3335. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  3336. %
  3337. \gdef\normalparens{\boldbrax\let&=\ampnr}
  3338. } % End of definition inside \activeparens
  3339. %% These parens (in \boldbrax) actually are a little bolder than the
  3340. %% contained text.  This is especially needed for [ and ]
  3341. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  3342. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  3343.  
  3344. % First, defname, which formats the header line itself.
  3345. % #1 should be the function name.
  3346. % #2 should be the type of definition, such as "Function".
  3347.  
  3348. \def\defname #1#2{%
  3349. % Get the values of \leftskip and \rightskip as they were
  3350. % outside the @def...
  3351. \dimen2=\leftskip
  3352. \advance\dimen2 by -\defbodyindent
  3353. \dimen3=\rightskip
  3354. \advance\dimen3 by -\defbodyindent
  3355. \noindent        %
  3356. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  3357. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  3358. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  3359. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  3360. % Now output arg 2 ("Function" or some such)
  3361. % ending at \deftypemargin from the right margin,
  3362. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  3363. {% Adjust \hsize to exclude the ambient margins,
  3364. % so that \rightline will obey them.
  3365. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  3366. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  3367. % Make all lines underfull and no complaints:
  3368. \tolerance=10000 \hbadness=10000
  3369. \advance\leftskip by -\defbodyindent
  3370. \exdentamount=\defbodyindent
  3371. {\df #1}\enskip        % Generate function name
  3372. }
  3373.  
  3374. % Actually process the body of a definition
  3375. % #1 should be the terminating control sequence, such as \Edefun.
  3376. % #2 should be the "another name" control sequence, such as \defunx.
  3377. % #3 should be the control sequence that actually processes the header,
  3378. %    such as \defunheader.
  3379.  
  3380. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  3381. \medbreak %
  3382. % Define the end token that this defining construct specifies
  3383. % so that it will exit this group.
  3384. \def#1{\endgraf\endgroup\medbreak}%
  3385. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  3386. \parindent=0in
  3387. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3388. \exdentamount=\defbodyindent
  3389. \begingroup %
  3390. \catcode 61=\active % 61 is `='
  3391. \obeylines\activeparens\spacesplit#3}
  3392.  
  3393. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  3394. \medbreak %
  3395. % Define the end token that this defining construct specifies
  3396. % so that it will exit this group.
  3397. \def#1{\endgraf\endgroup\medbreak}%
  3398. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  3399. \parindent=0in
  3400. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3401. \exdentamount=\defbodyindent
  3402. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  3403.  
  3404. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  3405. \medbreak %
  3406. % Define the end token that this defining construct specifies
  3407. % so that it will exit this group.
  3408. \def#1{\endgraf\endgroup\medbreak}%
  3409. \def#2##1 ##2 {\def#4{##1}%
  3410. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  3411. \parindent=0in
  3412. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3413. \exdentamount=\defbodyindent
  3414. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  3415.  
  3416. % These parsing functions are similar to the preceding ones
  3417. % except that they do not make parens into active characters.
  3418. % These are used for "variables" since they have no arguments.
  3419.  
  3420. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  3421. \medbreak %
  3422. % Define the end token that this defining construct specifies
  3423. % so that it will exit this group.
  3424. \def#1{\endgraf\endgroup\medbreak}%
  3425. \def#2{\begingroup\obeylines\spacesplit#3}%
  3426. \parindent=0in
  3427. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3428. \exdentamount=\defbodyindent
  3429. \begingroup %
  3430. \catcode 61=\active %
  3431. \obeylines\spacesplit#3}
  3432.  
  3433. % This is used for \def{tp,vr}parsebody.  It could probably be used for
  3434. % some of the others, too, with some judicious conditionals.
  3435. \def\parsebodycommon#1#2#3{%
  3436.   \begingroup\inENV %
  3437.   \medbreak %
  3438.   % Define the end token that this defining construct specifies
  3439.   % so that it will exit this group.
  3440.   \def#1{\endgraf\endgroup\medbreak}%
  3441.   \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  3442.   \parindent=0in
  3443.   \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3444.   \exdentamount=\defbodyindent
  3445.   \begingroup\obeylines
  3446. }
  3447.  
  3448. \def\defvrparsebody#1#2#3#4 {%
  3449.   \parsebodycommon{#1}{#2}{#3}%
  3450.   \spacesplit{#3{#4}}%
  3451. }
  3452.  
  3453. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  3454. % type is just `struct', because we lose the braces in `{struct
  3455. % termios}' when \spacesplit reads its undelimited argument.  Sigh.
  3456. % \let\deftpparsebody=\defvrparsebody
  3457. %
  3458. % So, to get around this, we put \empty in with the type name.  That
  3459. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  3460. % won't strip off the braces.
  3461. %
  3462. \def\deftpparsebody #1#2#3#4 {%
  3463.   \parsebodycommon{#1}{#2}{#3}%
  3464.   \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  3465. }
  3466.  
  3467. % Fine, but then we have to eventually remove the \empty *and* the
  3468. % braces (if any).  That's what this does, putting the result in \tptemp.
  3469. \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
  3470.  
  3471. % After \spacesplit has done its work, this is called -- #1 is the final
  3472. % thing to call, #2 the type name (which starts with \empty), and #3
  3473. % (which might be empty) the arguments.
  3474. \def\parsetpheaderline#1#2#3{%
  3475.   \removeemptybraces#2\relax
  3476.   #1{\tptemp}{#3}%
  3477. }%
  3478.  
  3479. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  3480. \medbreak %
  3481. % Define the end token that this defining construct specifies
  3482. % so that it will exit this group.
  3483. \def#1{\endgraf\endgroup\medbreak}%
  3484. \def#2##1 ##2 {\def#4{##1}%
  3485. \begingroup\obeylines\spacesplit{#3{##2}}}%
  3486. \parindent=0in
  3487. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  3488. \exdentamount=\defbodyindent
  3489. \begingroup\obeylines\spacesplit{#3{#5}}}
  3490.  
  3491. % Split up #2 at the first space token.
  3492. % call #1 with two arguments:
  3493. %  the first is all of #2 before the space token,
  3494. %  the second is all of #2 after that space token.
  3495. % If #2 contains no space token, all of it is passed as the first arg
  3496. % and the second is passed as empty.
  3497.  
  3498. {\obeylines
  3499. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  3500. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  3501. \ifx\relax #3%
  3502. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  3503.  
  3504. % So much for the things common to all kinds of definitions.
  3505.  
  3506. % Define @defun.
  3507.  
  3508. % First, define the processing that is wanted for arguments of \defun
  3509. % Use this to expand the args and terminate the paragraph they make up
  3510.  
  3511. \def\defunargs #1{\functionparens \sl
  3512. % Expand, preventing hyphenation at `-' chars.
  3513. % Note that groups don't affect changes in \hyphenchar.
  3514. \hyphenchar\tensl=0
  3515. #1%
  3516. \hyphenchar\tensl=45
  3517. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  3518. \interlinepenalty=10000
  3519. \advance\rightskip by 0pt plus 1fil
  3520. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  3521. }
  3522.  
  3523. \def\deftypefunargs #1{%
  3524. % Expand, preventing hyphenation at `-' chars.
  3525. % Note that groups don't affect changes in \hyphenchar.
  3526. \functionparens
  3527. \tclose{#1}% avoid \code because of side effects on active chars
  3528. \interlinepenalty=10000
  3529. \advance\rightskip by 0pt plus 1fil
  3530. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  3531. }
  3532.  
  3533. % Do complete processing of one @defun or @defunx line already parsed.
  3534.  
  3535. % @deffn Command forward-char nchars
  3536.  
  3537. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  3538.  
  3539. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  3540. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  3541. \catcode 61=\other % Turn off change made in \defparsebody
  3542. }
  3543.  
  3544. % @defun == @deffn Function
  3545.  
  3546. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  3547.  
  3548. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3549. \begingroup\defname {#1}{Function}%
  3550. \defunargs {#2}\endgroup %
  3551. \catcode 61=\other % Turn off change made in \defparsebody
  3552. }
  3553.  
  3554. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  3555.  
  3556. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  3557.  
  3558. % #1 is the data type.  #2 is the name and args.
  3559. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  3560. % #1 is the data type, #2 the name, #3 the args.
  3561. \def\deftypefunheaderx #1#2 #3\relax{%
  3562. \doind {fn}{\code{#2}}% Make entry in function index
  3563. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Function}%
  3564. \deftypefunargs {#3}\endgroup %
  3565. \catcode 61=\other % Turn off change made in \defparsebody
  3566. }
  3567.  
  3568. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  3569.  
  3570. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  3571.  
  3572. % \defheaderxcond#1\relax$$$
  3573. % puts #1 in @code, followed by a space, but does nothing if #1 is null.
  3574. \def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi}
  3575.  
  3576. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  3577. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  3578. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  3579. \def\deftypefnheaderx #1#2#3 #4\relax{%
  3580. \doind {fn}{\code{#3}}% Make entry in function index
  3581. \begingroup
  3582. \normalparens % notably, turn off `&' magic, which prevents
  3583. %               at least some C++ text from working
  3584. \defname {\defheaderxcond#2\relax$$$#3}{#1}%
  3585. \deftypefunargs {#4}\endgroup %
  3586. \catcode 61=\other % Turn off change made in \defparsebody
  3587. }
  3588.  
  3589. % @defmac == @deffn Macro
  3590.  
  3591. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  3592.  
  3593. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3594. \begingroup\defname {#1}{Macro}%
  3595. \defunargs {#2}\endgroup %
  3596. \catcode 61=\other % Turn off change made in \defparsebody
  3597. }
  3598.  
  3599. % @defspec == @deffn Special Form
  3600.  
  3601. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  3602.  
  3603. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  3604. \begingroup\defname {#1}{Special Form}%
  3605. \defunargs {#2}\endgroup %
  3606. \catcode 61=\other % Turn off change made in \defparsebody
  3607. }
  3608.  
  3609. % This definition is run if you use @defunx
  3610. % anywhere other than immediately after a @defun or @defunx.
  3611.  
  3612. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  3613. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  3614. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  3615. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  3616. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  3617. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  3618.  
  3619. % @defmethod, and so on
  3620.  
  3621. % @defop {Funny Method} foo-class frobnicate argument
  3622.  
  3623. \def\defop #1 {\def\defoptype{#1}%
  3624. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  3625.  
  3626. \def\defopheader #1#2#3{%
  3627. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  3628. \begingroup\defname {#2}{\defoptype{} on #1}%
  3629. \defunargs {#3}\endgroup %
  3630. }
  3631.  
  3632. % @defmethod == @defop Method
  3633.  
  3634. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  3635.  
  3636. \def\defmethodheader #1#2#3{%
  3637. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  3638. \begingroup\defname {#2}{Method on #1}%
  3639. \defunargs {#3}\endgroup %
  3640. }
  3641.  
  3642. % @defcv {Class Option} foo-class foo-flag
  3643.  
  3644. \def\defcv #1 {\def\defcvtype{#1}%
  3645. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  3646.  
  3647. \def\defcvarheader #1#2#3{%
  3648. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  3649. \begingroup\defname {#2}{\defcvtype{} of #1}%
  3650. \defvarargs {#3}\endgroup %
  3651. }
  3652.  
  3653. % @defivar == @defcv {Instance Variable}
  3654.  
  3655. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  3656.  
  3657. \def\defivarheader #1#2#3{%
  3658. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  3659. \begingroup\defname {#2}{Instance Variable of #1}%
  3660. \defvarargs {#3}\endgroup %
  3661. }
  3662.  
  3663. % These definitions are run if you use @defmethodx, etc.,
  3664. % anywhere other than immediately after a @defmethod, etc.
  3665.  
  3666. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  3667. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  3668. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  3669. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  3670.  
  3671. % Now @defvar
  3672.  
  3673. % First, define the processing that is wanted for arguments of @defvar.
  3674. % This is actually simple: just print them in roman.
  3675. % This must expand the args and terminate the paragraph they make up
  3676. \def\defvarargs #1{\normalparens #1%
  3677. \interlinepenalty=10000
  3678. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  3679.  
  3680. % @defvr Counter foo-count
  3681.  
  3682. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  3683.  
  3684. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  3685. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  3686.  
  3687. % @defvar == @defvr Variable
  3688.  
  3689. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  3690.  
  3691. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  3692. \begingroup\defname {#1}{Variable}%
  3693. \defvarargs {#2}\endgroup %
  3694. }
  3695.  
  3696. % @defopt == @defvr {User Option}
  3697.  
  3698. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  3699.  
  3700. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  3701. \begingroup\defname {#1}{User Option}%
  3702. \defvarargs {#2}\endgroup %
  3703. }
  3704.  
  3705. % @deftypevar int foobar
  3706.  
  3707. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  3708.  
  3709. % #1 is the data type.  #2 is the name.
  3710. \def\deftypevarheader #1#2{%
  3711. \doind {vr}{\code{#2}}% Make entry in variables index
  3712. \begingroup\defname {\defheaderxcond#1\relax$$$#2}{Variable}%
  3713. \interlinepenalty=10000
  3714. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  3715. \endgroup}
  3716.  
  3717. % @deftypevr {Global Flag} int enable
  3718.  
  3719. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  3720.  
  3721. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  3722. \begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1}
  3723. \interlinepenalty=10000
  3724. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  3725. \endgroup}
  3726.  
  3727. % This definition is run if you use @defvarx
  3728. % anywhere other than immediately after a @defvar or @defvarx.
  3729.  
  3730. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  3731. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  3732. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  3733. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  3734. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  3735.  
  3736. % Now define @deftp
  3737. % Args are printed in bold, a slight difference from @defvar.
  3738.  
  3739. \def\deftpargs #1{\bf \defvarargs{#1}}
  3740.  
  3741. % @deftp Class window height width ...
  3742.  
  3743. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  3744.  
  3745. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  3746. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  3747.  
  3748. % This definition is run if you use @deftpx, etc
  3749. % anywhere other than immediately after a @deftp, etc.
  3750.  
  3751. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  3752.  
  3753. \message{cross reference,}
  3754. % Define cross-reference macros
  3755. \newwrite \auxfile
  3756.  
  3757. \newif\ifhavexrefs  % True if xref values are known.
  3758. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  3759.  
  3760. % \setref{foo} defines a cross-reference point named foo.
  3761.  
  3762. \def\setref#1{%
  3763. \dosetq{#1-title}{Ytitle}%
  3764. \dosetq{#1-pg}{Ypagenumber}%
  3765. \dosetq{#1-snt}{Ysectionnumberandtype}}
  3766.  
  3767. \def\unnumbsetref#1{%
  3768. \dosetq{#1-title}{Ytitle}%
  3769. \dosetq{#1-pg}{Ypagenumber}%
  3770. \dosetq{#1-snt}{Ynothing}}
  3771.  
  3772. \def\appendixsetref#1{%
  3773. \dosetq{#1-title}{Ytitle}%
  3774. \dosetq{#1-pg}{Ypagenumber}%
  3775. \dosetq{#1-snt}{Yappendixletterandtype}}
  3776.  
  3777. % \xref, \pxref, and \ref generate cross-references to specified points.
  3778. % For \xrefX, #1 is the node name, #2 the name of the Info
  3779. % cross-reference, #3 the printed node name, #4 the name of the Info
  3780. % file, #5 the name of the printed manual.  All but the node name can be
  3781. % omitted.
  3782. %
  3783. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  3784. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  3785. \def\ref#1{\xrefX[#1,,,,,,,]}
  3786. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
  3787.   \def\printedmanual{\ignorespaces #5}%
  3788.   \def\printednodename{\ignorespaces #3}%
  3789.   \setbox1=\hbox{\printedmanual}%
  3790.   \setbox0=\hbox{\printednodename}%
  3791.   \ifdim \wd0 = 0pt
  3792.     % No printed node name was explicitly given.
  3793.     \ifx\SETxref-automatic-section-title\relax %
  3794.       % Use the actual chapter/section title appear inside
  3795.       % the square brackets.  Use the real section title if we have it.
  3796.       \ifdim \wd1>0pt%
  3797.         % It is in another manual, so we don't have it.
  3798.         \def\printednodename{\ignorespaces #1}%
  3799.       \else
  3800.         \ifhavexrefs
  3801.           % We know the real title if we have the xref values.
  3802.           \def\printednodename{\refx{#1-title}}%
  3803.         \else
  3804.           % Otherwise just copy the Info node name.
  3805.           \def\printednodename{\ignorespaces #1}%
  3806.         \fi%
  3807.       \fi
  3808.       \def\printednodename{#1-title}%
  3809.     \else
  3810.       % Use the node name inside the square brackets.
  3811.       \def\printednodename{\ignorespaces #1}%
  3812.     \fi
  3813.   \fi
  3814.   %
  3815.   % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
  3816.   % insert empty discretionaries after hyphens, which means that it will
  3817.   % not find a line break at a hyphen in a node names.  Since some manuals
  3818.   % are best written with fairly long node names, containing hyphens, this
  3819.   % is a loss.  Therefore, we give the text of the node name again, so it
  3820.   % is as if TeX is seeing it for the first time.
  3821.   \ifdim \wd1 > 0pt
  3822.     \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
  3823.   \else
  3824.     % _ (for example) has to be the character _ for the purposes of the
  3825.     % control sequence corresponding to the node, but it has to expand
  3826.     % into the usual \leavevmode...\vrule stuff for purposes of
  3827.     % printing. So we \turnoffactive for the \refx-snt, back on for the
  3828.     % printing, back off for the \refx-pg.
  3829.     {\turnoffactive \refx{#1-snt}{}}%
  3830.     \space [\printednodename],\space
  3831.     \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
  3832.   \fi
  3833. \endgroup}
  3834.  
  3835. % \dosetq is the interface for calls from other macros
  3836.  
  3837. % Use \turnoffactive so that punctuation chars such as underscore
  3838. % work in node names.
  3839. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  3840. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  3841. \next}}
  3842.  
  3843. % \internalsetq {foo}{page} expands into
  3844. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  3845. % When the aux file is read, ' is the escape character
  3846.  
  3847. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  3848.  
  3849. % Things to be expanded by \internalsetq
  3850.  
  3851. \def\Ypagenumber{\folio}
  3852.  
  3853. \def\Ytitle{\thissection}
  3854.  
  3855. \def\Ynothing{}
  3856.  
  3857. \def\Ysectionnumberandtype{%
  3858. \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
  3859. \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
  3860. \else \ifnum \subsubsecno=0 %
  3861. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
  3862. \else %
  3863. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  3864. \fi \fi \fi }
  3865.  
  3866. \def\Yappendixletterandtype{%
  3867. \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
  3868. \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
  3869. \else \ifnum \subsubsecno=0 %
  3870. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  3871. \else %
  3872. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  3873. \fi \fi \fi }
  3874.  
  3875. \gdef\xreftie{'tie}
  3876.  
  3877. % Use TeX 3.0's \inputlineno to get the line number, for better error
  3878. % messages, but if we're using an old version of TeX, don't do anything.
  3879. %
  3880. \ifx\inputlineno\thisisundefined
  3881.   \let\linenumber = \empty % Non-3.0.
  3882. \else
  3883.   \def\linenumber{\the\inputlineno:\space}
  3884. \fi
  3885.  
  3886. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  3887. % If its value is nonempty, SUFFIX is output afterward.
  3888.  
  3889. \def\refx#1#2{%
  3890.   \expandafter\ifx\csname X#1\endcsname\relax
  3891.     % If not defined, say something at least.
  3892.     $\langle$un\-de\-fined$\rangle$%
  3893.     \ifhavexrefs
  3894.       \message{\linenumber Undefined cross reference `#1'.}%
  3895.     \else
  3896.       \ifwarnedxrefs\else
  3897.         \global\warnedxrefstrue
  3898.         \message{Cross reference values unknown; you must run TeX again.}%
  3899.       \fi
  3900.     \fi
  3901.   \else
  3902.     % It's defined, so just use it.
  3903.     \csname X#1\endcsname
  3904.   \fi
  3905.   #2% Output the suffix in any case.
  3906. }
  3907.  
  3908. % Read the last existing aux file, if any.  No error if none exists.
  3909.  
  3910. % This is the macro invoked by entries in the aux file.
  3911. \def\xrdef #1#2{
  3912. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  3913.  
  3914. \def\readauxfile{%
  3915. \begingroup
  3916. \catcode `\^^@=\other
  3917. \catcode `\=\other
  3918. \catcode `\=\other
  3919. \catcode `\^^C=\other
  3920. \catcode `\^^D=\other
  3921. \catcode `\^^E=\other
  3922. \catcode `\^^F=\other
  3923. \catcode `\^^G=\other
  3924. \catcode `\^^H=\other
  3925. \catcode `\ =\other
  3926. \catcode `\^^L=\other
  3927. \catcode `\=\other
  3928. \catcode `\=\other
  3929. \catcode `\=\other
  3930. \catcode `\=\other
  3931. \catcode `\=\other
  3932. \catcode `\=\other
  3933. \catcode `\=\other
  3934. \catcode `\=\other
  3935. \catcode `\=\other
  3936. \catcode `\=\other
  3937. \catcode `\=\other
  3938. \catcode `\=\other
  3939. \catcode 26=\other
  3940. \catcode `\^^[=\other
  3941. \catcode `\^^\=\other
  3942. \catcode `\^^]=\other
  3943. \catcode `\^^^=\other
  3944. \catcode `\^^_=\other
  3945. \catcode `\@=\other
  3946. \catcode `\^=\other
  3947. \catcode `\~=\other
  3948. \catcode `\[=\other
  3949. \catcode `\]=\other
  3950. \catcode`\"=\other
  3951. \catcode`\_=\other
  3952. \catcode`\|=\other
  3953. \catcode`\<=\other
  3954. \catcode`\>=\other
  3955. \catcode `\$=\other
  3956. \catcode `\#=\other
  3957. \catcode `\&=\other
  3958. % `\+ does not work, so use 43.
  3959. \catcode 43=\other
  3960. % Make the characters 128-255 be printing characters
  3961. {%
  3962.   \count 1=128
  3963.   \def\loop{%
  3964.     \catcode\count 1=\other
  3965.     \advance\count 1 by 1
  3966.     \ifnum \count 1<256 \loop \fi
  3967.   }%
  3968. }%
  3969. % the aux file uses ' as the escape.
  3970. % Turn off \ as an escape so we do not lose on
  3971. % entries which were dumped with control sequences in their names.
  3972. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  3973. % Reference to such entries still does not work the way one would wish,
  3974. % but at least they do not bomb out when the aux file is read in.
  3975. \catcode `\{=1 \catcode `\}=2
  3976. \catcode `\%=\other
  3977. \catcode `\'=0
  3978. \catcode `\\=\other
  3979. \openin 1 \jobname.aux
  3980. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  3981. \global\warnedobstrue
  3982. \fi
  3983. % Open the new aux file.  Tex will close it automatically at exit.
  3984. \openout \auxfile=\jobname.aux
  3985. \endgroup}
  3986.  
  3987.  
  3988. % Footnotes.
  3989.  
  3990. \newcount \footnoteno
  3991.  
  3992. % The trailing space in the following definition for supereject is
  3993. % vital for proper filling; pages come out unaligned when you do a
  3994. % pagealignmacro call if that space before the closing brace is
  3995. % removed.
  3996. \def\supereject{\par\penalty -20000\footnoteno =0 }
  3997.  
  3998. % @footnotestyle is meaningful for info output only..
  3999. \let\footnotestyle=\comment
  4000.  
  4001. \let\ptexfootnote=\footnote
  4002.  
  4003. {\catcode `\@=11
  4004. %
  4005. % Auto-number footnotes.  Otherwise like plain.
  4006. \gdef\footnote{%
  4007.   \global\advance\footnoteno by \@ne
  4008.   \edef\thisfootno{$^{\the\footnoteno}$}%
  4009.   %
  4010.   % In case the footnote comes at the end of a sentence, preserve the
  4011.   % extra spacing after we do the footnote number.
  4012.   \let\@sf\empty
  4013.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  4014.   %
  4015.   % Remove inadvertent blank space before typesetting the footnote number.
  4016.   \unskip
  4017.   \thisfootno\@sf
  4018.   \footnotezzz
  4019. }%
  4020.  
  4021. % Don't bother with the trickery in plain.tex to not require the
  4022. % footnote text as a parameter.  Our footnotes don't need to be so general.
  4023. %
  4024. \long\gdef\footnotezzz#1{\insert\footins{%
  4025.   % We want to typeset this text as a normal paragraph, even if the
  4026.   % footnote reference occurs in (for example) a display environment.
  4027.   % So reset some parameters.
  4028.   \interlinepenalty\interfootnotelinepenalty
  4029.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  4030.   \splitmaxdepth\dp\strutbox
  4031.   \floatingpenalty\@MM
  4032.   \leftskip\z@skip
  4033.   \rightskip\z@skip
  4034.   \spaceskip\z@skip
  4035.   \xspaceskip\z@skip
  4036.   \parindent\defaultparindent
  4037.   %
  4038.   % Hang the footnote text off the number.
  4039.   \hang
  4040.   \textindent{\thisfootno}%
  4041.   %
  4042.   % Don't crash into the line above the footnote text.  Since this
  4043.   % expands into a box, it must come within the paragraph, lest it
  4044.   % provide a place where TeX can split the footnote.
  4045.   \footstrut
  4046.   #1\strut}%
  4047. }
  4048.  
  4049. }%end \catcode `\@=11
  4050.  
  4051. % Set the baselineskip to #1, and the lineskip and strut size
  4052. % correspondingly.  There is no deep meaning behind these magic numbers
  4053. % used as factors; they just match (closely enough) what Knuth defined.
  4054. %
  4055. \def\lineskipfactor{.08333}
  4056. \def\strutheightpercent{.70833}
  4057. \def\strutdepthpercent {.29167}
  4058. %
  4059. \def\setleading#1{%
  4060.   \normalbaselineskip = #1\relax
  4061.   \normallineskip = \lineskipfactor\normalbaselineskip
  4062.   \normalbaselines
  4063.   \setbox\strutbox =\hbox{%
  4064.     \vrule width0pt height\strutheightpercent\baselineskip
  4065.                     depth \strutdepthpercent \baselineskip
  4066.   }%
  4067. }
  4068.  
  4069. % @| inserts a changebar to the left of the current line.  It should
  4070. % surround any changed text.  This approach does *not* work if the
  4071. % change spans more than two lines of output.  To handle that, we would
  4072. % have adopt a much more difficult approach (putting marks into the main
  4073. % vertical list for the beginning and end of each change).
  4074. %
  4075. \def\|{%
  4076.   % \vadjust can only be used in horizontal mode.
  4077.   \leavevmode
  4078.   %
  4079.   % Append this vertical mode material after the current line in the output.
  4080.   \vadjust{%
  4081.     % We want to insert a rule with the height and depth of the current
  4082.     % leading; that is exactly what \strutbox is supposed to record.
  4083.     \vskip-\baselineskip
  4084.     %
  4085.     % \vadjust-items are inserted at the left edge of the type.  So
  4086.     % the \llap here moves out into the left-hand margin.
  4087.     \llap{%
  4088.       %
  4089.       % For a thicker or thinner bar, change the `1pt'.
  4090.       \vrule height\baselineskip width1pt
  4091.       %
  4092.       % This is the space between the bar and the text.
  4093.       \hskip 12pt
  4094.     }%
  4095.   }%
  4096. }
  4097.  
  4098. % For a final copy, take out the rectangles
  4099. % that mark overfull boxes (in case you have decided
  4100. % that the text looks ok even though it passes the margin).
  4101. %
  4102. \def\finalout{\overfullrule=0pt}
  4103.  
  4104.  
  4105. % End of control word definitions.
  4106.  
  4107. \message{and turning on texinfo input format.}
  4108.  
  4109. \def\openindices{%
  4110.    \newindex{cp}%
  4111.    \newcodeindex{fn}%
  4112.    \newcodeindex{vr}%
  4113.    \newcodeindex{tp}%
  4114.    \newcodeindex{ky}%
  4115.    \newcodeindex{pg}%
  4116. }
  4117.  
  4118. % Set some numeric style parameters, for 8.5 x 11 format.
  4119.  
  4120. %\hsize = 6.5in
  4121. \newdimen\defaultparindent \defaultparindent = 15pt
  4122. \parindent = \defaultparindent
  4123. \parskip 18pt plus 1pt
  4124. \setleading{15pt}
  4125. \advance\topskip by 1.2cm
  4126.  
  4127. % Prevent underfull vbox error messages.
  4128. \vbadness=10000
  4129.  
  4130. % Following George Bush, just get rid of widows and orphans.
  4131. \widowpenalty=10000
  4132. \clubpenalty=10000
  4133.  
  4134. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  4135. % using an old version of TeX, don't do anything.  We want the amount of
  4136. % stretch added to depend on the line length, hence the dependence on
  4137. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  4138. %
  4139. \ifx\emergencystretch\thisisundefined
  4140.   % Allow us to assign to \emergencystretch anyway.
  4141.   \def\emergencystretch{\dimen0}%
  4142. \else
  4143.   \emergencystretch = \hsize
  4144.   \divide\emergencystretch by 45
  4145. \fi
  4146.  
  4147. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  4148. \def\smallbook{
  4149.  
  4150. % These values for secheadingskip and subsecheadingskip are
  4151. % experiments.  RJC 7 Aug 1992
  4152. \global\secheadingskip = 17pt plus 6pt minus 3pt
  4153. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  4154.  
  4155. \global\lispnarrowing = 0.3in
  4156. \setleading{12pt}
  4157. \advance\topskip by -1cm
  4158. \global\parskip 3pt plus 1pt
  4159. \global\hsize = 5in
  4160. \global\vsize=7.5in
  4161. \global\tolerance=700
  4162. \global\hfuzz=1pt
  4163. \global\contentsrightmargin=0pt
  4164. \global\deftypemargin=0pt
  4165. \global\defbodyindent=.5cm
  4166.  
  4167. \global\pagewidth=\hsize
  4168. \global\pageheight=\vsize
  4169.  
  4170. \global\let\smalllisp=\smalllispx
  4171. \global\let\smallexample=\smalllispx
  4172. \global\def\Esmallexample{\Esmalllisp}
  4173. }
  4174.  
  4175. % Use @afourpaper to print on European A4 paper.
  4176. \def\afourpaper{
  4177. \global\tolerance=700
  4178. \global\hfuzz=1pt
  4179. \setleading{12pt}
  4180. \global\parskip 15pt plus 1pt
  4181.  
  4182. \global\vsize= 53\baselineskip
  4183. \advance\vsize by \topskip
  4184. %\global\hsize=   5.85in     % A4 wide 10pt
  4185. \global\hsize=  6.5in
  4186. \global\outerhsize=\hsize
  4187. \global\advance\outerhsize by 0.5in
  4188. \global\outervsize=\vsize
  4189. \global\advance\outervsize by 0.6in
  4190.  
  4191. \global\pagewidth=\hsize
  4192. \global\pageheight=\vsize
  4193. }
  4194.  
  4195. % Allow control of the text dimensions.  Parameters in order: textheight;
  4196. % textwidth; \voffset; \hoffset (!); binding offset.  All require a dimension;
  4197. % header is additional; added length extends the bottom of the page.
  4198.  
  4199. \def\changepagesizes#1#2#3#4#5
  4200. {\global\vsize= #1
  4201.  \advance\vsize by \topskip
  4202.  \global\voffset= #3
  4203.  \global\hsize= #2
  4204.  \global\outerhsize=\hsize
  4205.  \global\advance\outerhsize by 0.5in
  4206.  \global\outervsize=\vsize
  4207.  \global\advance\outervsize by 0.6in
  4208.  \global\pagewidth=\hsize
  4209.  \global\pageheight=\vsize
  4210.  \global\normaloffset= #4
  4211.  \global\bindingoffset= #5}
  4212.  
  4213. % This layout is compatible with Latex on A4 paper.
  4214.  
  4215. \def\afourlatex{\changepagesizes{22cm}{15cm}{7mm}{4.6mm}{5mm}}
  4216.  
  4217. % Define macros to output various characters with catcode for normal text.
  4218. \catcode`\"=\other
  4219. \catcode`\~=\other
  4220. \catcode`\^=\other
  4221. \catcode`\_=\other
  4222. \catcode`\|=\other
  4223. \catcode`\<=\other
  4224. \catcode`\>=\other
  4225. \catcode`\+=\other
  4226. \def\normaldoublequote{"}
  4227. \def\normaltilde{~}
  4228. \def\normalcaret{^}
  4229. \def\normalunderscore{_}
  4230. \def\normalverticalbar{|}
  4231. \def\normalless{<}
  4232. \def\normalgreater{>}
  4233. \def\normalplus{+}
  4234.  
  4235. % This macro is used to make a character print one way in ttfont
  4236. % where it can probably just be output, and another way in other fonts,
  4237. % where something hairier probably needs to be done.
  4238. %
  4239. % #1 is what to print if we are indeed using \tt; #2 is what to print
  4240. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  4241. % interword stretch (and shrink), and it is reasonable to expect all
  4242. % typewriter fonts to have this, we can check that font parameter.
  4243. %
  4244. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  4245.  
  4246. % Turn off all special characters except @
  4247. % (and those which the user can use as if they were ordinary).
  4248. % Most of these we simply print from the \tt font, but for some, we can
  4249. % use math or other variants that look better in normal text.
  4250.  
  4251. \catcode`\"=\active
  4252. \def\activedoublequote{{\tt \char '042}}
  4253. \let"=\activedoublequote
  4254. \catcode`\~=\active
  4255. \def~{{\tt \char '176}}
  4256. \chardef\hat=`\^
  4257. \catcode`\^=\active
  4258. \def^{{\tt \hat}}
  4259.  
  4260. \catcode`\_=\active
  4261. \def_{\ifusingtt\normalunderscore\_}
  4262. % Subroutine for the previous macro.
  4263. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  4264.  
  4265. % \lvvmode is equivalent in function to \leavevmode.
  4266. % Using \leavevmode runs into trouble when written out to
  4267. % an index file due to the expansion of \leavevmode into ``\unhbox
  4268. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  4269. % magic tricks with @.
  4270. \def\lvvmode{\vbox to 0pt{}}
  4271.  
  4272. \catcode`\|=\active
  4273. \def|{{\tt \char '174}}
  4274. \chardef \less=`\<
  4275. \catcode`\<=\active
  4276. \def<{{\tt \less}}
  4277. \chardef \gtr=`\>
  4278. \catcode`\>=\active
  4279. \def>{{\tt \gtr}}
  4280. \catcode`\+=\active
  4281. \def+{{\tt \char 43}}
  4282. %\catcode 27=\active
  4283. %\def^^[{$\diamondsuit$}
  4284.  
  4285. % Set up an active definition for =, but don't enable it most of the time.
  4286. {\catcode`\==\active
  4287. \global\def={{\tt \char 61}}}
  4288.  
  4289. \catcode`\@=0
  4290.  
  4291. % \rawbackslashxx output one backslash character in current font
  4292. \global\chardef\rawbackslashxx=`\\
  4293. %{\catcode`\\=\other
  4294. %@gdef@rawbackslashxx{\}}
  4295.  
  4296. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  4297. {\catcode`\\=\active
  4298. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  4299.  
  4300. % \normalbackslash outputs one backslash in fixed width font.
  4301. \def\normalbackslash{{\tt\rawbackslashxx}}
  4302.  
  4303. % Say @foo, not \foo, in error messages.
  4304. \escapechar=`\@
  4305.  
  4306. % \catcode 17=0   % Define control-q
  4307. \catcode`\\=\active
  4308.  
  4309. % Used sometimes to turn off (effectively) the active characters
  4310. % even after parsing them.
  4311. @def@turnoffactive{@let"=@normaldoublequote
  4312. @let\=@realbackslash
  4313. @let~=@normaltilde
  4314. @let^=@normalcaret
  4315. @let_=@normalunderscore
  4316. @let|=@normalverticalbar
  4317. @let<=@normalless
  4318. @let>=@normalgreater
  4319. @let+=@normalplus}
  4320.  
  4321. @def@normalturnoffactive{@let"=@normaldoublequote
  4322. @let\=@normalbackslash
  4323. @let~=@normaltilde
  4324. @let^=@normalcaret
  4325. @let_=@normalunderscore
  4326. @let|=@normalverticalbar
  4327. @let<=@normalless
  4328. @let>=@normalgreater
  4329. @let+=@normalplus}
  4330.  
  4331. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  4332. % That is what \eatinput is for; after that, the `\' should revert to printing
  4333. % a backslash.
  4334. %
  4335. @gdef@eatinput input texinfo{@fixbackslash}
  4336. @global@let\ = @eatinput
  4337.  
  4338. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  4339. % the first `\{ in the file would cause an error. This macro tries to fix
  4340. % that, assuming it is called before the first `\' could plausibly occur.
  4341. %
  4342. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  4343.  
  4344. %% These look ok in all fonts, so just make them not special.  The @rm below
  4345. %% makes sure that the current font starts out as the newly loaded cmr10
  4346. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  4347.  
  4348. @textfonts
  4349. @rm
  4350.  
  4351. @c Local variables:
  4352. @c page-delimiter: "^\\\\message"
  4353. @c End:
  4354.